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 15 forks source link

New input - Turn on/off current output index #100

Open linker3000 opened 5 months ago

linker3000 commented 5 months ago

This is a great node - thanks for creating it.

May I request the following new input be considered:

Msg.topic = Device name or index Msg.payload = SETON or SETOFF

Turns ON or OFF (overrides) the current state of the given output (assuming it's currently enabled). Other future timer settings for the name or index behave as normal.

Msg.topic of -1 overrides all currently active timer schedules.

Bonus feature: Msg.topic can be an array of outputs to override!

This would allow a current on/off condition to be overridden - for example, turning off one or more heaters because the weather has warmed up and they no longer need to be on for the rest of the timer period, or if arriving at an office early and wanting to turn the heating on without disrupting the normal set schedules.

I might have a go at coding this myself, but I am not the greatest programmer!

Thanks

fellinga commented 4 months ago

That sounds a lot like the existing "disableDevice" feature. If you send msg.disableDevice with a value of 0 for example it will completely deactivate the schedule of the first device.

It's documented in the nodes help section: image

msg.disableDevice / msg.enableDevice does the same thing that the alarm clock symbol in the ui does: image

There is no always on option currently though. Does this help?

linker3000 commented 4 months ago

Thanks,

The enable/disableDevice features aren't quite what I was looking for.

Here's a scenario: Timer 0 is due to turn on a heater from 0900 to 1600, but you arrive at work early at 0830 and want to turn the heater on at that time.

I'd like a timer-driven option to override the ON time for timer 0 so it comes on 'now', but then follows any valid timer setting for the next OFF time.

The enableDevice feature would enable timer 0 if it was disabled, but won't start any enabled schedules early.

I could create a separate button to just turn on a device, but wanted to route things through the timer node so that the dashbaord visualisation changed to match. As it happens, I have started to implement some functions to read the stored settings and then push changes into the timer node, so I could implement this 'early on' as an external function rather than generate the need for node code changes:

https://github.com/linker3000/node-red-contrib-ui-time-scheduler-support-functions