I have lights that I turn on at night to a dim 25% setting to serve as soft lighting in certain areas. The thing is, if someone is already in that room, and has the lights fully on at 100%, the automation will dim them down to 25%, which is a bad experience. I realize I could add a condition to check if the light was lower than 25% before calling the light.turn_on
service, but that has a few issues:
- It will require separating all my lights out into their own condition check/service call pairs. Right now I have one script I call which calls
light.turn_on
on a bunch of entities at once (and thenswitch.turn_on
on a few smart switches). - It requires me to update the x% setting in two places, the condition and the service call.
- Checking if lights are either off or on but set to a lower brightness level is clunky. The brightness attribute isn’t available when they’re off, so instead of just saying < x%, you have to use an
or
around two conditions, one checking if they’re off and the other checking if the brightness attribute is < x%.
I suspect there is no better way to do this than a bunch of scripts, one for each light, where I take in the desired brightness level, and both check against that, and then set the light to that. Actually, it’s just occurring to me that I could take in the light entity as an argument too and just have the one script. Still I’d need to make a bunch of calls to it, rather than a single call where I just list entities, but perhaps that is good enough.
Anyone have any other approaches they use for this? Is there some option to the light.turn_on
service that I’m missing that would do this for me?