Time based automations, with Node-RED

Time based flows are probably the easiest to do. In this example, you can see that I’m using an inject node set to trigger at 8pm to set my Ecobee thermostat to 73*. The same with setting the alarm, turning lights on and off, etc.

Setting up something to trigger at a specific time is easy. Grab an inject node, and configure it similarly to this:

The payload can stay as a timestamp if you want, I just always change it to what I want it to do, just ’cause. You can see that it is set to repeat at a specific time (10:30pm), everyday of the week. In the first screenshot you can see that the 10:30pm node arms the house if the house isn’t armed, starts the subflow to close the garage if open, the subflow to turn off the front porch light if on, and the subflow to turn off the backyard flood light if on.

For the “Every 30 minutes” inject node, it connects to a time range node that only allows the inject node to work between 11 pm and 4:30am. This will check to be sure all the things I want to happen over night, happen, even if they are somehow missed by the 10:30 trigger. There is a better way to do this, but this is how to do it in it’s most basic form.

Here’s what the every 30 minute inject node looks like:

Here’s how the time frame node looks:

The big green node at the top of the flow is the bigtimer node. It operates sort of like a time range node and an inject node. I have it configured in it’s most basic way. It sends a message at sunset, and another at sunrise, which toggles my exterior light automations. Here’s how that node looks:

These are very basic ways to setup time based automations. In the future I will show how to set everything up in one fluid flow, but this will get you headed in the right direction.

Here’s the code.