Skip to content

Instantly share code, notes, and snippets.

@tzapu
Created December 18, 2021 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzapu/08daf3bd23ce32716282dfa1b56d8d10 to your computer and use it in GitHub Desktop.
Save tzapu/08daf3bd23ce32716282dfa1b56d8d10 to your computer and use it in GitHub Desktop.
ha blink
blueprint:
name: flashing lights
description: 'Flashing lights via on off and delay and finally restore the previous
light states.
'
domain: automation
source_url: https://community.home-assistant.io/t/simple-flashing-lights-via-on-off-and-delay-restore-previous-light-states/258099
input:
activated:
name: Activated
description: Enter the Entity Name for Trigger (On-Off)
selector:
entity:
domain: input_boolean
target_lights:
name: Lights
description: To flashing lights
selector:
target:
entity:
domain: light
color_rgb:
name: RGBColor
description: Choose the color for blinking lights
selector:
select:
options:
- white
- red
- green
- lime
- blue
- navy
- yellow
- orange
- turquoise
- violet
- magenta
- aliceblue
- antiquewhite
- aquamarine
- aqua
- cadetblue
- coral
- cornflowerblue
- crimson
- darkblue
- darkorange
- darkorchid
- darksalmon
- darkslategray
- deeppink
- darkviolet
- deepskyblue
- ghostwhite
- gold
- lawngreen
- lightcoral
- lightgreen
- lightseagreen
brightness_rgb:
name: (OPTIONAL) Light Brightness
description: Color Brigthness between 0 to 255
selector:
number:
min: 0
max: 255
unit_of_measurement: RGB
step: 1.0
mode: slider
delay:
name: (OPTIONAL) Delay
description: Delay flashing lights
default: 1000
selector:
number:
min: 0.0
max: 20000.0
unit_of_measurement: milliseconds
step: 1.0
mode: slider
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\n | map(attribute='entity_id')\
\ | join(',') %}\n {{lights}}\n"
- service: light.turn_on
target: !input 'target_lights'
data:
color_name: !input 'color_rgb'
brightness: !input 'brightness_rgb'
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment