diff --git a/time/timeswitch/package.json b/time/timeswitch/package.json index aa6ff72c..71917d79 100644 --- a/time/timeswitch/package.json +++ b/time/timeswitch/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-timeswitch", - "version" : "0.2.2", + "version" : "1.0.0", "description" : "A Node-RED node to provide a simple timeswitch to schedule daily on/off events.", "dependencies" : { - "spacetime": "^6.16.3", + "spacetime": "^7.4.0", "suncalc": "^1.8.0" }, "repository" : { diff --git a/time/timeswitch/timeswitch.js b/time/timeswitch/timeswitch.js index 3048f378..fc5e3c87 100644 --- a/time/timeswitch/timeswitch.js +++ b/time/timeswitch/timeswitch.js @@ -23,7 +23,7 @@ module.exports = function (RED) { this.thu = n.thu; this.fri = n.fri; this.sat = n.sat; - + this.jan = n.jan; this.feb = n.feb; this.mar = n.mar; @@ -123,17 +123,20 @@ module.exports = function (RED) { // handler function for the node payload, called below let sendPayload = (payload, nextTime) => { + // var o = nextTime.goto(selectedTimeZone.name).offset()/60; + // if (o > 0) { o = "+" + o; } + // else {o = "-" + o; } if (payload == 1) { node.status({ fill: "yellow", shape: "dot", - text: `on until ${nextTime.format("time")}` + text: `on until ${nextTime.goto(selectedTimeZone.name).format("time-24")}` }); } else { node.status({ fill: "blue", shape: "dot", - text: `off until ${nextTime.format("time")}` + text: `off until ${nextTime.goto(selectedTimeZone.name).format("time-24")}` }); } var msg = {}; @@ -157,9 +160,9 @@ module.exports = function (RED) { case 6 : { if (!node.sat) { proceed &= false; } break; } } - if (!proceed) { - sendPayload(0, selectedOnTime); - return; + if (!proceed) { + sendPayload(0, selectedOnTime); + return; } // if this month is not among the selected months, stop here