Using lights as a reusable notification for events

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?

Is the idea to have all indicator lights go off at the same time or something more selective?

Yes, all indicator lights would go off and behave the same way

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.

No, you just put it in the script and pass it as a variable from wherever you call it.

Scripts - Passing Variables to Scripts

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”:

sequence:
  - action: scene.create
    metadata: {}
    data:
      scene_id: indicator_lights_current
      snapshot_entities: |
        {{ state_attr('light.indicator_lights','entity_id') }}
  - repeat:
      count: 5
      sequence:
        - action: light.turn_on
          metadata: {}
          target:
            entity_id: light.indicator_lights
          data:
            transition: 0
            rgb_color: "{{ color | default([255, 0, 0]) }}"
        - delay: 1
        - action: light.turn_off
          metadata: {}
          target:
            entity_id: light.indicator_lights
          data: {}
        - delay: 1
  - action: scene.turn_on
    metadata: {}
    data:
      transition: 1
    target:
      entity_id: scene.indicator_lights_current
alias: Indicator Lights Flash
description: ""
fields:
  color:
    selector:
      color_rgb: null
    name: Light Color
    description: The color the light should flash
    required: true

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 wasn’t my first rodeo… :grin:

1 Like