1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Fix timeswitch status to show time in timezone set in the properties

and bump library
This commit is contained in:
Dave Conway-Jones 2023-01-19 09:34:28 +00:00
parent 8553dc30f2
commit f7f313c197
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 11 additions and 8 deletions

View File

@ -1,9 +1,9 @@
{ {
"name" : "node-red-node-timeswitch", "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.", "description" : "A Node-RED node to provide a simple timeswitch to schedule daily on/off events.",
"dependencies" : { "dependencies" : {
"spacetime": "^6.16.3", "spacetime": "^7.4.0",
"suncalc": "^1.8.0" "suncalc": "^1.8.0"
}, },
"repository" : { "repository" : {

View File

@ -123,17 +123,20 @@ module.exports = function (RED) {
// handler function for the node payload, called below // handler function for the node payload, called below
let sendPayload = (payload, nextTime) => { let sendPayload = (payload, nextTime) => {
// var o = nextTime.goto(selectedTimeZone.name).offset()/60;
// if (o > 0) { o = "+" + o; }
// else {o = "-" + o; }
if (payload == 1) { if (payload == 1) {
node.status({ node.status({
fill: "yellow", fill: "yellow",
shape: "dot", shape: "dot",
text: `on until ${nextTime.format("time")}` text: `on until ${nextTime.goto(selectedTimeZone.name).format("time-24")}`
}); });
} else { } else {
node.status({ node.status({
fill: "blue", fill: "blue",
shape: "dot", shape: "dot",
text: `off until ${nextTime.format("time")}` text: `off until ${nextTime.goto(selectedTimeZone.name).format("time-24")}`
}); });
} }
var msg = {}; var msg = {};