Fix NPE on wifi reconnect
This commit is contained in:
@@ -82,7 +82,9 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
var setState = function(state) {
|
var setState = function(state) {
|
||||||
var status = null;
|
var status = null;
|
||||||
var info = {"payload": {
|
var info = null;
|
||||||
|
if (plug) {
|
||||||
|
info = {"payload": {
|
||||||
"id": plug.id,
|
"id": plug.id,
|
||||||
"type": plug.type,
|
"type": plug.type,
|
||||||
"model": plug.model,
|
"model": plug.model,
|
||||||
@@ -91,6 +93,7 @@ module.exports = function(RED) {
|
|||||||
"port": plug.port,
|
"port": plug.port,
|
||||||
"power": plug.power()
|
"power": plug.power()
|
||||||
}};
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
if (state === "on") {
|
if (state === "on") {
|
||||||
node.status({fill:"green", shape:"dot", text:"on"});
|
node.status({fill:"green", shape:"dot", text:"on"});
|
||||||
|
|||||||
Reference in New Issue
Block a user