Flashing Lights Script

Hi everyone,

I’d like to share my flashing lights script which is based upon Rschuttes automation blueprint which did the same thing, this is essentially most of that but as a script rather than an automation.

Features:

  • Blink Your Lights: Select specific lights to blink in a chosen color.
  • Customizable Blinking:
    • Choose how many times the lights blink.
    • Set how long each blink lasts.
    • Option to turn the lights off between blinks or keep their original color.
  • Custom Transition Times:
    • Override default device transition settings with a specified transition length, ensuring smooth and visible blinking effects.
sequence:
  - action: scene.create
    metadata: {}
    data:
      scene_id: flash_restore_state
      snapshot_entities: "{{ light_selection }}"
    alias: Save a restore point for the selected lights
  - alias: Flash the lights the selected number of times
    repeat:
      count: "{{ flash_lights_count }}"
      sequence:
        - action: light.turn_on
          metadata: {}
          data:
            rgb_color: "{{ flash_lights_color }}"
            brightness_pct: "{{ flash_brightness }}"
            transition: "{{ transition_length }}"
          target:
            entity_id: "{{ light_selection }}"
          alias: Flash the selected light a chosen color and brightness
        - delay: "{{ flash_duration }}"
          alias: The selected delay between flashes
        - alias: Flash from off or the original state of the lights
          choose:
            - conditions:
                - condition: template
                  value_template: "{{ flash_from_off }}"
                  alias: Flashing the lights from an off state was requested
              sequence:
                - action: light.turn_off
                  metadata: {}
                  data:
                    transition: "{{ transition_length }}"
                  target:
                    entity_id: "{{ light_selection }}"
                  alias: Turn off the selected lights
            - conditions:
                - condition: template
                  value_template: "{{ not flash_from_off }}"
                  alias: Flashing the lights from the original state was requested
              sequence:
                - action: scene.turn_on
                  metadata: {}
                  data: {}
                  target:
                    entity_id: scene.flash_restore_state
                  alias: Restore the original state of the lights
        - delay: "{{ flash_duration }}"
          alias: The selected delay between flashes
  - action: scene.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: scene.flash_restore_state
    alias: Restore the original state of the lights
  - alias: Delete the saved light scene
    action: scene.delete
    metadata: {}
    data: {}
    target:
      entity_id: scene.flash_restore_state
fields:
  light_selection:
    name: 💡 Light Selection
    description: Select which lights to flash
    selector:
      entity:
        multiple: true
        domain: light
    required: true
  flash_lights_color:
    selector:
      color_rgb: {}
    name: 🎨 Flash Lights Color
    description: What color should the lights flash?
    default:
      - 0
      - 0
      - 0
    required: true
  flash_brightness:
    selector:
      number:
        min: 1
        max: 100
        step: 1
    name: 🌞 Flash Brightness
    description: How bright should the flash be?
    default: 90
    required: true
  flash_lights_count:
    selector:
      number:
        min: 1
        max: 15
        step: 1
    name: 🔢 Flash Lights Count
    description: How many times should the lights flash?
    required: true
    default: 10
  flash_duration:
    selector:
      number:
        min: 0.1
        max: 5
        step: 0.1
    name: ⏱️ Flash Duration
    description: Length of time between flashes (in seconds)
    default: 1
    required: true
  flash_from_off:
    selector:
      boolean: {}
    name: 🌙 Flash From Off
    description: Should the lights turn off between flashes?
    default: true
    required: false
  transition_length:
    selector:
      number:
        min: 0
        max: 5
        step: 0.1
    name: 🔁 Transition Length
    description: Set a custom transition time for the lights (In seconds)
    default: 0.3
    required: true
alias: Flash the Selected Lights
description: >-
  Flash the selected lights from either the current or off state then return to
  the original lighting scene
mode: restart

1 Like

Getting a “No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.” so I’m presuming it hasn’t liked the reference. I’m very new to sharing my scripts and making them to be fair.

I copied the direct link to the post without success, i think its looking for a specific formatting? I’ll need to do a bit of reading on how to do that. This is just a straight script for people at the moment.

Still get an error when trying to import it myself I’ll try again later tonight

Didn’t know that existed but yeah it would be better. I don’t have permission to delete this though :frowning: I’d need to delete the other ones i posted too.