I thought this would be a cool way to see how folks are implementing automation rules. As is pretty well established in the HE community, there's a plethora of ways to achieve a specific goal. I thought this to be a way to get ideas or learn something new or find a more efficient way to achieve a goal.
The Goal:
Fully automate as much as possible of the fan/light operations for the bathroom.
The idea:
My approach was to write a single rule to handle all automation for each of my bathrooms. This rule is duplicated for each bathroom. The bathroom has a Tuya bulb over the shower and regular lighting over the vanity. Everything is on z-wave switches. I'm using [APP] Smarter Humidity Fan *FORK for Testing* to handle automating the exhaust fan when showering based on humidity. There's a virtual switch that is turned on/off based on the humidity breaking my threshold in the app.
The Logic:
Trigger: Motion detected (I realized while writing this that I can remove the other trigger)
Actions:
-
If motion detected between 8 am and 11 PM
- Set the shower light to white and 100%
- Turn on the lights
- Cancel delayed actions (the delayed actions come into play for turning everything off below)
-
If motion detected between 11 PM and 8 am:
- Set the shower light to red and 100%
- Turn on the shower light only
- Cancel delayed actions (the delayed actions come into play for turning everything off below)
-
End motion activated loop (more for delimitating sections for readability).
-
If motion inactive, humidity VS is turned off, but the fan is turned on (meaning someone is taking the brown's to the superbowl)
- Wait four minutes and turn off the vanity lights (this serves as a warning to move if you're still sitting on the thrown. We have all surely ran into the issue of not moving enough to trigger the motion sensor).
- Wait five minutes and turn off the shower light and fan (this is usually enough time to fully vent the room).
-
If motion inactive and humidity VS is turned on (meaning someone is in the shower):
- Cancel delayed actions
-
If motion inactive, humidity VS is turned off, and the fan is off (meaning the person walked out or is just standing in front of the mirror staring at themselves like a serial killer)
- Wait 1 minute and 30 seconds, then turn off the lights (don't need to turn the fan off since it has to be off for this part to run).
Payoff:
- Lights always come on when walking in with the appropriate color for time of day.
- Lights will stay on while you're on the throne. Only caveat is if you sit still for too long, but the single light toggle is a visual alert to move.
- The fan can be left on and forgot about after dropping the kids off at the pool.
- Lights stay on while showering
Possible Improvements
- Add logic to capture the bulb color before shifting to "night mode" and restoring the color in the morning.
- Figuring out a way to automatically determine when someone is filling the peanut butter jar to handle turning the fan on.