2
0

Merge pull request #35 from artemsuv/fix_data_not_defined

fix(socket) fix ReferenceError: data is not define
This commit is contained in:
Pierre CLÉMENT
2018-04-17 12:52:54 +02:00
committed by GitHub

View File

@@ -13,9 +13,9 @@ module.exports = (RED) => {
var payload = msg.payload;
if(payload.sid) {
if (payload.sid == this.sid) {
if (data.status && data.status == "on") {
if (payload.data && payload.data.status && payload.data.status == "on") {
this.status({fill:"green", shape:"dot", text:"on"});
} else if (data.status && data.status == "off") {
} else if (payload.data && payload.data.status && payload.data.status == "off") {
this.status({fill:"red", shape:"dot", text:"off"});
}
this.send(msg);