wemo-client
wemo-client copied to clipboard
Sonoff Wemo Emulation Support
Hi there
I have a Sonoff Basic running Tasmota firmware, these support use via Amazon Alexa by running a Wemo emulator.
Seeing this I manually added my Sonoff device (as discovery did not work) and it returns the device information fine but would not action commands or subscription to events.
I have managed to get the 'setBinaryState' and 'getBinaryState' commands working by adding the "Content-Length" header under 'soapAction' and then inserting the length of the payload string as the data value. It seems that the Wemo emulation on the Sonoff does not support the "Transfer-Encoding: chunked" header which gets applied by default by the 'http.request function' (link) if the "Content-Length" header is not present.
var payload = (body ? xml.ele(body) : xml).end();
var options = {
host: this.host,
port: this.port,
path: this.services[serviceType].controlURL,
method: 'POST',
headers: {
'SOAPACTION': '"' + serviceType + '#' + action + '"',
'Content-Type': 'text/xml; charset="utf-8"',
'Content-Length': payload.length
}
};
It does not look like the Wemo emulation currently supports event subscription but I am looking into this currently.