Relative newbie here. I’ve watched a zillion YouTube videos and read the docs, but I haven’t seen the solution to what I feel must be a common problem.
I have a number of rooms containing lights that I’d like to turn on using a motion sensor (all of which works fine) but in each case, I need to add a condition. Only turn on the lights if:
The sun is up (indicating that it’s daytime), or
The bedroom light is on (indicating that we’re still awake)
We don’t want the lights to go on if the cats trigger them in the night time, or if one of us wanders down the hallway at night for some reason, which would shine a bright light into the bedroom. Right now, I’m using the same condition for each room, but I’d like to centralize that.
As a retired developer, it makes me uncomfortable to duplicate such code. If the condition were to change, it would change for all four rooms that use the same condition–and I’d have to go update each automation individually.
Is there some way to “centralize” a condition like this, so I could change it once and it would apply to all the automations that use it as their condition? I feel this must be possible, but the solution is evading me. Thanks!
This turns two lamps in the living room on if motion is detected, and leaves them on for 10 minutes (extended if movement is detected again). If the lights are switched on manually, they will stay on for half an hour, or until they are switched off manually. If the override sensor is on, the lights will not come on.
I have several overrides for different parts of the house, which get more or less daylight during the day. All are threshold helpers derived from a single outside light sensor. You can have more than one override per light, so you could create another based on the bedroom light.
I appreciate the other answers, and will review and study them, but this is exactly what I was seeking. I felt for sure that a template was the answer, but couldn’t figure out how to start. I will use this and research more. Thanks so much!
Blueprints seem like a good answer as well, but if I need to change the condition later, would it apply to all the automations that use it? I guess so—i’ll have to try it. Thanks!