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

Trigger JSON string from the nodes top output via input messag #34

Closed KaHeMu closed 3 years ago

KaHeMu commented 3 years ago

Hello fellinga,

First of all, great job! I started to use your timer for all my smart home devices incl. window shutters. One request: Would it be possible to add a function that triggers the top output that sends the JSON config string with a input message? Let me explain in more detail: I would like to display the next upcoming on/off or open/close for each device at a different place in my dashboard. For this I can extract the "starttime" and "days[]" from the JSON output string that I store in an object (or file). This works well for the fixed starttimes but not for solar events which move a little bit from day to day. If a user hasn't modified the timer for a while the solar events starttimes in the JSON file divert a lot from the actual starttime in your timer that I would like to get access to. Ideally the solution would be that the timer simply sends a JSON to the top output when a config msg is sent to its input but with the solar times updated.
Thank you for considering this!

fellinga commented 3 years ago

Hi @KaHeMu ,

happy to hear that you found some useful applications for the node! 👍 You are absolutely right, start and end times are always recorded from the day they were created and later updated during runtime and after a output to the top output. As you said, right now there is no way to trigger a manual save action without actually modifying something.

One solution right now would be to send a msg to the node that disables a device and send another message a second after that to enable the device again - this would trigger the node to output the current values (you could schedule that with an injection node at midnight for example).

1

Please let me know if this helps!

KaHeMu commented 3 years ago

Hi @fellinga, Thanks a lot for the hint. This is exactly what I was looking for. I admit that I did not read the manual carefully enough and missed the "disableDevice" configuration feature. (Instead I wrote a function that parses and manipulates the config JSON for enabling/disabling timers selectively :-) ). Thanks again.

fellinga commented 3 years ago

I just pushed 1.10.2 that also accepts a getStatus property that only outputs the current data. You should receive an update at any time from now on.

1