Fix Wemo emulation

Fix Wemo emulation to select the first relay when more than one relay is present (#3657)
This commit is contained in:
Theo Arends 2018-09-02 14:26:00 +02:00
parent a60876378f
commit 0ac8c73938
2 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,7 @@
* Fix possible ambiguity on command parameters if StateText contains numbers only (#3656)
* Fix possible exception due to buffer overflow (#3659)
* Add Wifi channel number to state message (#3664)
* Fix Wemo emulation to select the first relay when more than one relay is present (#3657)
*
* 6.2.0 20180901
* Allow user override of define MAX_RULE_VARS and MAX_RULE_TIMERS (#3561)

View File

@ -386,12 +386,18 @@ void HandleUpnpEvent()
String state_xml = FPSTR(WEMO_RESPONSE_STATE_SOAP);
//differentiate get and set state
if (request.indexOf(F("SetBinaryState")) > 0) {
uint8_t power = POWER_TOGGLE;
if (request.indexOf(F("State>1</Binary")) > 0) {
ExecuteCommandPower(devices_present, POWER_ON, SRC_WEMO);
power = POWER_ON
}
else if (request.indexOf(F("State>0</Binary")) > 0) {
ExecuteCommandPower(devices_present, POWER_OFF, SRC_WEMO);
power = POWER_OFF;
}
if (power != POWER_TOGGLE) {
uint8_t device = (light_type) ? devices_present : 1; // Select either a configured light or relay1
ExecuteCommandPower(device, power, SRC_WEMO);
}
}
else if(request.indexOf(F("GetBinaryState")) > 0){
state_xml.replace(F("Set"), F("Get"));