Node-BYTES

These are small Node-RED flows that are easy to learn from and implement.

Tattle-Tell Flow

Sometimes our son gets up in the middle of the night, sneaks into our room and then like a ninja, he’s in bed with us. Unfortunately though, that’s where his stealth ends, because once he’s back asleep, it turns into Wrestle Mania as he kicks me in the cheek, elbows the wife in the kidney…it goes on and on. Instead of being woken up in this manner and then taking him back to his bed, I wanted to have the house tell me when he gets up and beat him to the punch (yuk, yuk).

This one is pretty straight forward. If Wyatt’s door is opened between 9pm and 5am, AND the TV lights are off AND the pendants lights are off, AND the kitchen lights are off, set the Master Bedroom Google Home to 50% volume and say “Wyatt’s Awake”. All of the AND’s determine if anyone is awake in the house. Here is the code to import.

Wyatt’s Color Changing Lamp Flow

This one is a little more complicated, but not too bad. I had a spare SmartThings button hanging around, as well as a Hue A19 color bulb, so I thought I’d try to do something fun. I was wanting to learn more about function nodes (as of this writing, I’m still learning about them) so this is what I came up with, after getting help from the amazing Home Assistant community.

This one grabs the zha_events using a “events: all” node, and hands it off to a “switch” node, that filters the button presses from this specific button. The time range node splits off the automation, one for after 5a to before 9p, and the other for after 9p to 5a, which is handed off to another “switch” node that filters out what kind of button press, (long, single or double) which is then handed off to the correct output of the switch. If it’s before 9pm, a single button press turns on the lamp, and changes between 8 preset colors with every single press, a long press will continually loop between those colors, and a double press will turn everything off.

If it’s after 9pm, a single press will only turn the lamp on (while cancelling the color loop if running) to 10% red, and double press will turn the lamp off. I also have an inject node the will turn the lamp on at 10%, and cancel the loop if the colors are looping. This makes the button redundant at 9pm, but I’ve had the inject node not work for whatever reason, so this makes it easy to just press the button to get back to 10% red. The delay nodes are there because on occasion, if the color loop was running, the button press would have to happen twice, once to cancel the loop and again to set the light to 10%. Resetting the loop and adjusting the light at the same time would conflict, hence the 200ms delay, which seems to have corrected this issue.

I had to create the after 9pm part of the flow because the weight of the responsibility of changing light colors on a whim was too great for a 3 year old to bare. Here be the code.

Time Based Flows

Another simple one. Time based flows are probably the easiest to do. All you need is an “inject” node, set to trigger at a specific time and any node that will perform a function. A “call service” node is a simple one to use. In this example, you can see that I’m using an inject node set to trigger at 9pm to set my Ecobee thermostat to 73*. Same with setting the alarm, turning lights on and off, etc. Here’s the code.