How can I flash a group of light switches

I have several zwave light switches. I want them to flash about once every 5 seconds for a period of time. I want this for my fire/co detectors. I already have an automation that turns them on, but individually

You should be able to just add a Group helper with all of the switches in it and then your automation will just trigger the group.

I have all the switches in the automation and they turn on at the same time, I think I eluded that they wnet on individually. I am in need of some means to turn them all on wait 5 seconds then turn them back on for 5 seconds, etc until a time that I set or until I tell the automation to stop.

alias: Flash lights
trigger:
- platform: state
  entity_id: binary_sensor.your_fire_co_detector
  from: 'off'
  to: 'on'
action:
- repeat:
    while:
    - condition: state
      entity_id: binary_sensor.your_fire_co_detector
      state: 'on'
    sequence:
    - service: light.toggle
      target:
        entity_id: light.your_light
    - delay: '00:00:05'
- service: light.turn_off
  target:
    entity_id: light.your_light

Can I group the fire_co_detectors and reference them all together? I have 3 Smoke/CO detectors. I created a helper for the light switches but I don’t see a way to do that with the detectors. The code you provided is inserted into the config.yaml correct?

You didn’t provide the names of any entities you are using so the example I posted uses fictitious names and is meant to be adapted to whatever you are using.

Yes. If they’re all binary_sensor entities then you can create a Binary Sensor Group.

  1. Copy the example I posted above.
  2. Use the Automation Editor to create a new empty automation.
  3. Click the overflow menu (three vertical dots) in the Editor’s upper-right corner and select “Edit in YAML”.
  4. Delete whatever is displayed in the editing window and paste my example.
  5. Change the entity names to whatever you are using.
  6. Click the Save button.

The resulting automation will be stored in the automations.yaml file (assuming your configuration.yaml file contains automation: !include automations.yaml which is the default setting).

Can’t tell I am new at this can you :)) Thanks I will see if I can get it going.

Ok I created a binary sensor group and here is what I’ve got

alias: Flash lights
trigger:
- platform: state
  entity_id: binary_sensor.fire_alarm_sensors
  from: 'off'
  to: 'on'
action:
- repeat:
    while:
    - condition: state
      entity_id: binary_sensor.fire_alarm_sensors
      state: 'on'
    sequence:
    - service: light.toggle
      target:
        entity_id: light.alarm_light_group
    - delay: '00:00:05'
- service: light.turn_off
  target:
    entity_id: light.alarm_light_group

So another question pops up. How can I stop this automation once it starts. Say in the occasion of a false trip? Can I use a button to “reset” it or to ignore the on state of the device and then return the lights to original state?

I think I have the last bit figured out. I created a entities card with the automation as a switch, now I can disable and enable the automation if I need to.

I don’t recommend you do that.

The automation will automatically stop flashing the lights the moment the state of binary_sensor.your_fire_co_detector returns to off. So when your binary sensor group’s state returns to off the repeat ceases looping and the automation executes the last action, namely light.turn_off.

If you believe that’s still insufficient control of it’s looping behavior, I suggest creating an Input Boolean helper to serve as a “master control”. Let me know if that interests you and I’ll show you how to modify the repeat’s condition.

Just don’t turn on/off the entire automation as a means of controlling its light-flashing behavior. It makes it too easy to accidentally prevent the automation from working when you need it most.

Good points. Lets try the helper you suggest. The poing for flashing the lights is to wake us up if the siren doesn’t work (another automation, which I might attach to this one) and to provide a visual with outside lights flashing for authorities. Thank you for all your help.

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.