I have some color changing bulbs that I want to use to notify about certain events. For example, dim the light orange repeatedly if the baby is crying on the baby monitor, purple if there’s someone at the door, green if the microwave just turned off, etc.
I might add more indicator lights down the line, and might add new events to notify, or maybe tweak the dimming logic/timing, etc.
How can I create this dimming logic such that I can re-use it more easily for other events or update it once when I add another indicator light so all events trigger the new light?
The first step is to decide how you want to create your group. Either a Light Group Helper or Labels will work.
Then I would use a script that starts by create an ad hoc scene that takes a snapshot of all the lights in the group, then use a repeat to flash color - off the desired number of times. And finally turn the stored scene on to go back to the way the lights were.
And where would I put the color aspect? Do I create a scene for each color? If so. Then it seems anytime I’m making a change to how the flashing/dimming works I have to update each color scene.
Depending on how flexible you want to make it, you could also set up the number of repeats, the transitions length, or pretty much any other parts of the light.turn_on action as variables as well.
Here’s a quick sketch using a Light Group Helper with the entity ID “light.indicator_lights”:
You’ll need to adjust the transitions and delays to work with your lights, not all devices support transition and some may have a minimum transition time so you won’t get a full “off” if the delay is too short. Keep in mind that you don’t have to use a light.turn_off action, you could use another light.turn_on action with a lower brightness, different color, etc.
Oh wow. Thanks so much for that! I have to do some testing and maybe some changes to the code, but with that script I can use a standard automation and turn that specific script on as an action. Even more amazing, the UI for that action automatically produces the color picker.
This is pretty much exactly what I built - Signal Lights. Define colored signals with triggers (entity state, threshold, template), register your lights, and it handles the priority queue.