fellinga / node-red-contrib-ui-time-scheduler

Easily power on/off any kind of device based on a schedule that you can easily create at the node-red-dashboard frontend.
MIT License
37 stars 17 forks source link

[Question]starttime and endtime format json #81

Closed Ataraxiall closed 2 years ago

Ataraxiall commented 2 years ago

Good morning,

I have a question. Why in the output payload, the starttime and the endtime is from a timestamp of the current day? For example, if I put it to end on Wednesday at 2:00 p.m., the timestamp is from today specifically. "{"timers":[{"starttime":1656453600000,"days":[1,1,1,0,0,0,0],"output":"0","endtime":1656504000000}],"settings":{"disabledDevices":["0"]}}" image

next Wednesday is supposed to be a different value. right?

Thanks!

fellinga commented 2 years ago

I am just using the timestamp to store hours and minutes in UTC format. It also helps to calculate on/off times for different time zones.

A new timer will always have the current day as date, no matter the actual day the timer goes off. The on/off days are determined by the days array, which is also stored in UTC days.

What exactly are you trying to accomplish?

fellinga commented 2 years ago

I have posted an explanation here: https://github.com/fellinga/node-red-contrib-ui-time-scheduler/issues/83#issuecomment-1225183552