Skip to content

Commit

Permalink
Correction to topicStatusGet support
Browse files Browse the repository at this point in the history
Added support to more then 1 possible topic (POWER) in RESULT - it will check based on field in topic and if has any data
  • Loading branch information
bibiak1 committed Apr 13, 2019
1 parent 7897ea7 commit a52d77f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Expand Up @@ -111,12 +111,12 @@ function MqttSwitchTasmotaAccessory(log, config) {
// This assumes that the Sonoff single will return the value { "POWER" : "ON" }
var data = JSON.parse(message);
var status = data.POWER;
if(data.hasOwnProperty(that.powerValue)){
var status = data[that.powerValue];
that.switchStatus = (status == that.onValue);
that.log(that.name, "(",that.powerValue,") - Power from Status", status); //TEST ONLY
if (data.hasOwnProperty(that.powerValue))
status = data[that.powerValue];
if (status !== undefined) {
that.switchStatus = (status == that.onValue);
that.log(that.name, "(",that.powerValue,") - Power from Status", status); //TEST ONLY
}

} catch (e) {
var status = message.toString();

Expand Down

0 comments on commit a52d77f

Please sign in to comment.