Simple ... flashing light's via on off and delay. Restore previous light states

Tags: #<Tag:0x00007f325ce35f18> #<Tag:0x00007f325ce35e50>

This is a simple blueprint for flashing light’s via on/off and delay. Activated and deactived via input_boolean and restore previous light state.

Link to Blueprint: https://github.com/myGithub-Markus/home-assistant_blueprints/blob/main/flashing_lights.yaml

blueprint:
  name: flashing lights
  description: >
     Flashing lights via on off and delay and finally restore the previous light states.
  domain: automation
  source_url: https://github.com/myGithub-Markus/home-assistant_blueprints/edit/main/flashing_lights.yaml
  input:
    activated:
        name: Activated
        description: "Toggle to activated or deactivated flashing. E.g. for fire alarm"
        selector:
            entity:
                domain: input_boolean
    target_lights:
        name: Lights
        description: "To flashing lights"
        selector:
          target:
            entity:
              domain: light
    delay:
      name: (OPTIONAL) Delay
      description: "Delay flashing lights"
      default: 1000
      selector:
        number:
          min: 0
          max: 20000
          unit_of_measurement: milliseconds

mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input activated
    to: 'on'

variables:
  activated: !input activated
  delay: !input delay
  target_lights: !input target_lights

condition: []

action:
  - service: scene.create
    data:
        scene_id: all_lights_snapshot
        snapshot_entities: >
               {% set lights = states.light
                 | map(attribute='entity_id') | join(',') %}
                 {{lights}}
  - service: light.turn_on
    target: !input target_lights
  - repeat:
      while:
      - condition: template
        value_template: "{{ activated == none or is_state(activated, 'on') }}"
      sequence:
      - delay: 
          milliseconds: "{{ delay }}"
      - service: light.toggle
        target: !input target_lights
  - service: scene.turn_on
    data:
      entity_id: scene.all_lights_snapshot

Preview Blueprint Automation GUI

3 Likes

This is very useful, thank you!

I installed it and noticed that it only works with entity types : light. I adapted this to show also type: switch but it did not work (although the entities -> switch can be selected). Any clue what more we need to adapt to the script? Thanks in advance!

Could this be set to select a red colour and flash it?

Could. When it wouldn’t be buggy.

I’m still pretty new but under “Activated” I cant choose anything to trigger the flashing. I want to choose my doorbell here.

same. nothing is showing up on mine either.

the current blueprint only supports input_boolean under “Activated”. So if you configured any input_boolean it should be available under Activated.

input_boolean:
  flashing_lights:
    name: Activated and deactivated flashing lights
- id: '4711'
  alias: flashing lights
  description: ''
  use_blueprint:
    path: .../flashing_lights.yaml
    input:
      delay: '1000'
      activated: input_boolean.flashing_lights
      target_lights:
        entity_id: light.all_indoor

Brilliant - thank you!