Recently while discussing the subject of home automation with my SO, she mentioned that she’d like a way to be notified what the weather was going to be when she’s getting ready. The timing of this couldn’t be any better as I had just started playing around with an automation to do this very thing.
The best and worst part of this was that I already have all the hardware installed to make this happen. Our hallway has a receptacle where I’ve mounted the Xiaomi Hub (pronounced shaw-me) as well as a motion sensor in the ceiling fixture. The has an RGB LED light ring that will be in the perfect location in front of the bathroom. Luckily, because I live in San Francisco, we really only notification for abnormal weather of it being hot (above 72 degrees) or raining. Yes, I know 72 isn’t hot if you are in many parts of the world, but for SF residents it’s hot.
Node-RED is my automation engine for all of my Home Assistant needs, so naturally, this is where it’s built. Here is what the flow looks like. It is available here for you to import into your system.
This is a pretty basic flow:
- It’s triggered by the hall motion sensor
- If the time is between the set range, the flow continues
- The flow splits into two and checks each individual weather entity, and if it meets the requirement, the flow continues to trigger each light.
- If a weather flow continues, it also triggers a 60-minute timer to turn off the light
Some things to note:
- There is a throttling node that limits the number of times this “runs” to once per half hour
- A second delay helps spread out the requests to HA
- Before turning off the light, I set it to white for a split second so that a future turn-on of the light will be white instead of the previously set red or blue
- This can easily be expanded to multiple other weather entities and to include additional lights