Node-Red configurable trigger times
I've recently moved from fixed trigger times for certain (mostly lighting) events to user-configurable. This provides me an easy way to configure via a Home Assistant dashboard.
This is achieved by the use of some helpers and a simple node-red subflow:
The subflow code can be downloaded here for import into your node-red instance.
The subflow outputs one of the following values:
- Morning
- Day
- Evening
- Night
- Unknown (if no matching timeframe is found)
Based on matching the helper values in a cascade of time_range nodes in the subflow.
To use it you'll need to create "time" helpers with the following entity ids:
input_datetime.morning_start
input_datetime.morning_end
input_datetime.day_start
input_datetime.day_end
input_datetime.evening_start
input_datetime.evening_end
input_datetime.night_start
input_datetime.night_end
which can then be added to a dashboard for easy editing.
Comments
Post a Comment