🚨 Custom Blinking Lights Blueprint

Blinking Lights with Restore and Transition – Updated Blueprint :tada:

Hi everyone,

I’m excited to share an updated version of the Blinking Lights blueprint! This blueprint allows you to blink selected lights in a specific color and then restore them to their original state, with added support for custom transition times. :rocket:

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.
  • State-Triggered Automation:
    • Specify a trigger entity and optional from and to states to control when the blinking starts.

Use Cases:

  • Notifications: Get a visual alert when a state changes (e.g., doorbell, motion sensor).
  • Custom Light Effects: Add dynamic blinking effects for parties or events.
  • Silent Night Alerts: Use lights instead of sound during specific hours.

Example Configuration:

  • Blink Duration: 1 second
  • Transition Time: 0.5 seconds
  • Blink Count: 3 times
  • The lights will smoothly transition between states, ensuring the blinking effect is clear and seamless.

How to Use:

  1. Import the blueprint via the link: Blueprint Link.
  2. Set up the automation with your preferred lights, colors, and other options.
  3. Enjoy your custom blinking lights with restored states and transitions.

Feedback and Suggestions:

I’d love to hear your thoughts! If you find any issues or have ideas for further improvements, feel free to share them in the comments.

Enjoy the update! :blush:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

The Blueprint Code

Here’s the complete YAML for the blueprint:

blueprint:
  name: Blinking Lights with Restore and Transition
  description: Blink selected lights in a specific color and restore their original state, with custom transition support.
  domain: automation
  input:
    lights:
      name: Lights
      description: Select the lights to blink.
      selector:
        target:
          entity:
          - domain:
            - light
    color:
      name: Blink Color
      description: Choose a color for blinking.
      selector:
        color_rgb: {}
    blink_count:
      name: Blink Count
      description: How many times should the lights blink?
      default: 3
      selector:
        number:
          min: 1.0
          max: 10.0
          step: 1.0
          mode: slider
    blink_duration:
      name: Blink Duration (seconds)
      description: How long should each blink last?
      default: 1
      selector:
        number:
          min: 0.1
          max: 5.0
          step: 0.1
          mode: slider
    trigger_entity:
      name: Trigger Entity
      description: Select the entity that triggers this automation.
      selector:
        entity:
          multiple: false
    from_state:
      name: From State (optional)
      description: Enter the state to trigger from (leave empty for any state).
      default: ''
      selector:
        text:
          multiline: false
          multiple: false
    to_state:
      name: To State (optional)
      description: Enter the state to trigger to (leave empty for any state).
      default: ''
      selector:
        text:
          multiline: false
          multiple: false
    flash_with_off:
      name: Flash with Off
      description: Turn off lights between blinks? If unchecked, the lights will return
        to their original color between blinks.
      default: true
      selector:
        boolean: {}
    transition_length:
      name: Transition Length (seconds)
      description: Set a custom transition time for the lights (overrides device default).
      default: 0.5
      selector:
        number:
          min: 0
          max: 5
          step: 0.1
  source_url: https://community.home-assistant.io/t/custom-blinking-lights-blueprint/796494
mode: restart
variables:
  lights: !input lights
  blink_count: !input blink_count
  blink_duration: !input blink_duration
  color: !input color
  trigger_entity: !input trigger_entity
  from_state: !input from_state
  to_state: !input to_state
  flash_with_off: !input flash_with_off
  transition_length: !input transition_length
trigger:
- platform: state
  entity_id: !input trigger_entity
action:
- service: scene.create
  data:
    scene_id: light_restore_scene
    snapshot_entities: '{{ lights.entity_id }}'
- repeat:
    count: '{{ blink_count }}'
    sequence:
    - service: light.turn_on
      target: '{{ lights }}'
      data:
        rgb_color: '{{ color }}'
        brightness: 255
        transition: '{{ transition_length }}'
    - delay: '{{ blink_duration | float }}'
    - choose:
      - conditions:
        - condition: template
          value_template: '{{ flash_with_off }}'
        sequence:
        - service: light.turn_off
          target: '{{ lights }}'
          data:
            transition: '{{ transition_length }}'
      - conditions:
        - condition: template
          value_template: '{{ not flash_with_off }}'
        sequence:
        - service: scene.turn_on
          data:
            entity_id: scene.light_restore_scene
    - delay: '{{ blink_duration | float }}'
- service: scene.turn_on
  data:
    entity_id: scene.light_restore_scene
2 Likes

Thanks for sharing !

Works great, very useful and a nice easy one to configure. I will use this for a number of notifications now.

My only request if possible is rather than turn off the light during the cycle, keep the existing colour and flash the alert colour with the existing light colour setting.

Thanks

1 Like

Hi Richard Schutte,

Thanks for contributing to the community with your blueprint.

I have a suggestion for you. People that are less familiar with HA will be looking for the ‘my’ link to load your stuff.
Here is the link to make that so you can paste it in your top post.
Create a link – My Home Assistant

2 Likes

Thank you for the feedback and for taking the time to share your suggestion! I really appreciate it. :blush:

I’ve now created the My Home Assistant link to make it easier for everyone to import the blueprint directly.

Thank you for your feedback and suggestion! I’ve created an updated version of the blueprint that keeps the existing light color visible while flashing the alert color. However, after testing, I noticed that this effect might not be as smooth or optimal in certain scenarios, depending on the light hardware and how it handles rapid color changes.

Here’s the updated code for you to try:

blueprint:
  name: Blinking Lights with Overlay Color
  description: Flash selected lights in an alert color over their current state and restore the original state.
  domain: automation
  input:
    lights:
      name: Lights
      description: Select the lights to flash.
      selector:
        target:
          entity:
            domain: light
    color:
      name: Alert Color
      description: Choose a color for flashing.
      selector:
        color_rgb:
    blink_count:
      name: Blink Count
      description: How many times should the lights flash the alert color?
      default: 3
      selector:
        number:
          min: 1
          max: 10
          step: 1
    blink_duration:
      name: Flash Duration (seconds)
      description: How long should the alert color last during each flash?
      default: 1
      selector:
        number:
          min: 0.1
          max: 5
          step: 0.1

mode: restart

variables:
  lights: !input lights
  blink_count: !input blink_count
  blink_duration: !input blink_duration
  color: !input color

trigger:
  platform: event
  event_type: automation.triggered

action:
  - service: scene.create
    data:
      scene_id: light_restore_scene
      snapshot_entities: "{{ lights.entity_id }}"

  - repeat:
      count: "{{ blink_count }}"
      sequence:
        - service: light.turn_on
          target: "{{ lights }}"
          data:
            rgb_color: "{{ color }}"
            brightness: 255
        - delay: "{{ blink_duration | float }}"
        - service: scene.turn_on
          data:
            entity_id: scene.light_restore_scene
        - delay: "{{ blink_duration | float }}"

  - service: scene.turn_on
    data:
      entity_id: scene.light_restore_scene

Feel free to give it a try and let me know your thoughts. If this doesn’t meet your needs, I’m happy to explore other options! :blush:

Richard,

Again many thanks for taking the time to make this custom change.
10/10 - Code works perfect on my setup.

For info I am using two Sonoff QMS-5C-RGB lamps in my living room.

I have a Hikvision CCTV system linked into HA with 6 camera’s covering the house perimeter. With HA I use line crossing zones so depending on which camera detects the crossing I wanted to flash the living room light under certain conditions. (On a night, watching TV when no one should be around) The colour schemes will work ideal to identify the zone of detection.

Thanks again!

1 Like

I’ve updated the blueprint to include a flexible trigger mechanism! :tada:

You can now:

  • Select a trigger entity (e.g., a switch, motion sensor, etc.).
  • Optionally specify from and to states for the trigger to fire only on specific state changes.

If no from_state or to_state is provided, the automation will trigger on any state change. Let me know how it works for you or if you have more feedback! :blush:

2 Likes

WOW- This is like getting a custom blueprint made for me.
I was just about to make the automations using the line crossing triggers when I saw your post. This will make this blueprint so useful and simplifies the triggers. Thanks!

Only request is I presume this turns the light off. Between blinks per original blueprint. Maybe add a checkbox option to flash with an off or keep the lights original colour. This would merge the blueprint nicely into one moving forward.
Cheers!

Hi! I’ve updated the blueprint to include a checkbox option for flashing with lights off or keeping the original color between blinks. Could you test the new version and let me know if it works as you’d hoped? I’d love to hear your feedback! :blush:

blueprint:
  name: Blinking Lights with Restore
  description: Blink selected lights in a specific color and restore their original state.
  domain: automation
  input:
    lights:
      name: Lights
      description: Select the lights to blink.
      selector:
        target:
          entity:
            - domain:
                - light
    color:
      name: Blink Color
      description: Choose a color for blinking.
      selector:
        color_rgb: {}
    blink_count:
      name: Blink Count
      description: How many times should the lights blink?
      default: 3
      selector:
        number:
          min: 1.0
          max: 10.0
          step: 1.0
          mode: slider
    blink_duration:
      name: Blink Duration (seconds)
      description: How long should each blink last?
      default: 1
      selector:
        number:
          min: 0.1
          max: 5.0
          step: 0.1
          mode: slider
    trigger_entity:
      name: Trigger Entity
      description: Select the entity that triggers this automation.
      selector:
        entity: {}
    from_state:
      name: From State (optional)
      description: Enter the state to trigger from (leave empty for any state).
      default: ""
      selector:
        text: {}
    to_state:
      name: To State (optional)
      description: Enter the state to trigger to (leave empty for any state).
      default: ""
      selector:
        text: {}
    flash_with_off:
      name: Flash with Off
      description: Turn off lights between blinks? If unchecked, the lights will return to their original color between blinks.
      default: true
      selector:
        boolean: {}
  source_url: https://community.home-assistant.io/t/custom-blinking-lights-blueprint/796494
mode: restart
variables:
  lights: !input lights
  blink_count: !input blink_count
  blink_duration: !input blink_duration
  color: !input color
  trigger_entity: !input trigger_entity
  from_state: !input from_state
  to_state: !input to_state
  flash_with_off: !input flash_with_off

trigger:
  - platform: state
    entity_id: !input trigger_entity

action:
  - service: scene.create
    data:
      scene_id: light_restore_scene
      snapshot_entities: "{{ lights.entity_id }}"
  - repeat:
      count: "{{ blink_count }}"
      sequence:
        - service: light.turn_on
          target: "{{ lights }}"
          data:
            rgb_color: "{{ color }}"
            brightness: 255
        - delay: "{{ blink_duration | float }}"
        - choose:
            - conditions:
                - condition: template
                  value_template: "{{ flash_with_off }}"
              sequence:
                - service: light.turn_off
                  target: "{{ lights }}"
            - conditions:
                - condition: template
                  value_template: "{{ not flash_with_off }}"
              sequence:
                - service: scene.turn_on
                  data:
                    entity_id: scene.light_restore_scene
        - delay: "{{ blink_duration | float }}"
  - service: scene.turn_on
    data:
      entity_id: scene.light_restore_scene

[Update] Blinking Lights with Restore: Enhanced Features :rocket:

Hi everyone! :wave:

I’ve updated the Blinking Lights with Restore blueprint to make it more flexible and user-friendly. Here’s what’s new:


:new: New Features

  1. Trigger with State Conditions:
  • The blueprint now supports triggering based on the state of an entity.
  • You can define:
    • Trigger Entity: Select the entity to trigger the automation (e.g., a switch or motion sensor).
    • From State (optional): Specify the state the entity transitions from.
    • To State (optional): Specify the state the entity transitions to.
  • If no states are specified, the automation triggers on any state change.
  1. Flash Option:
  • Added a checkbox to customize the blinking behavior:
    • Checked (default): Lights turn off between blinks (original behavior).
    • Unchecked: Lights restore to their original state (e.g., color and brightness) between blinks.
  • This combines two use cases into one blueprint for greater flexibility.

How It Works

  1. Trigger Behavior:
  • The automation starts when the specified trigger_entity changes state. Optional conditions for from_state and to_state let you narrow down the triggering scenario.
  1. Action Behavior:
  • The automation blinks the selected lights in the specified color and duration for the given count.
  • Based on the Flash Option, the lights either:
    • Turn off between blinks.
    • Restore to their original state between blinks.
  1. Restoration:
  • After the blinking sequence completes, the lights return to their original state.

Example Use Case

  • Trigger: Motion sensor detecting motion (from_state: off, to_state: on).
  • Lights: Select multiple lights to blink in a chosen color.
  • Flash Option:
    • Checked: Lights turn off briefly between blinks for a more alerting effect.
    • Unchecked: Lights return to their original color and brightness between blinks for a softer notification.

Trigger function is working great!

I don’t think the check box is working correct however. Light will turn off between blinks on either setting of the checkbox position.

Good progress for a very functional Blueprint now though.

EDIT :- the Checkbox position is now working. Not sure what I changed.
The only finding and not sure how It happens yet but sometimes from a light off state and turning on it is turning on with the colour preset from automation.

I’ll work out what sequence it is…

EDIT :- Ok, it seems to be if the lights are in the off state and then get a trigger they will do the blink sequence as normal and turn off.

When they are next turned on however they turn on with the colour that was preset in the automation.

1 Like

Great!!
Can you make a timer too it?

Thank you so much for your patience and suggestions. I have to admit that I’m struggling to resolve this issue properly. Despite multiple attempts to implement the requested functionality, I haven’t been able to get the automation to work as expected in all scenarios, especially when handling lights that are initially off and ensuring their exact state is restored afterward.

I think this challenge might require a different perspective or a level of expertise I currently don’t have. If you have further insights or ideas, I’d greatly appreciate your input. In the meantime, I’ll keep experimenting, and if I manage to find a solution, I’ll make sure to share it with you.

Thanks again for your understanding and support!

Thank you for your feedback! Regarding the timer functionality, while it’s not directly integrated into this blueprint, you can achieve the same result by using an external automation that triggers this one after a specific delay. This way, the timer logic stays separate, and it keeps this blueprint focused on its core purpose.

If you need help setting up that additional automation, feel free to ask.

After it blonks flr some tlme, it just stops while the inpit_boolean switxh is srill turned on. Would be great to ler it keep blonking until i tjrn the switch off manually. Thanks in advance.

Thanks i will try

Thank you for your feedback and suggestion! While the idea of continuous blinking is interesting, it’s not what this blueprint is designed for. The purpose of this blueprint is to handle a fixed number of blinks and then restore the lights to their original state.

For a setup where the blinking continues indefinitely until an input_boolean is turned off, it would likely require a completely different approach. This could be achieved with a custom automation or script specifically designed for that functionality.

I’d recommend exploring that route if you’d like this behavior.

Thanks again for your input!

Good morning, hello.
I have a problem that when I execute - service: light.turn_on (or off) and if the esphome device has the default_transition_length: record, this value is used because there is no transit value of its own in the execution section where the service is called. when blink_duration is shorter than default_transition_length from esp, then automation loses its meaning because the effect is not visible everywhere where it is needed :wink: is it possible to add a transit length option to the light settings, which will overwrite the default device settings?

apart from this small detail, the blueprint is great! this is what I needed to set the doorbell to silent/night mode in specific situations/hours, thank you!

Alrigh thank you for the Information. I’ve modified the Blueprint to fulfill my needs. I’ll share the modified Blueprint below for anybody else who may want to do the same.

alias: Continuous Blinking Lights
description: "Blink lights continuously until the switch is turned off."
trigger:
  - platform: state
    entity_id: input_boolean.blinking_lights
    to: "on"
action:
  - repeat:
      while:
        - condition: state
          entity_id: input_boolean.blinking_lights
          state: "on"
      sequence:
        - service: light.turn_on
          target:
            entity_id:
              - light.lichtgruppe
              - light.rgb_strip
          data:
            rgb_color: [255, 123, 0]
        - delay: "00:00:01"
        - service: light.turn_off
          target:
            entity_id:
              - light.lichtgruppe
              - light.rgb_strip
        - delay: "00:00:01"
mode: restart
1 Like

Good afternoon, and thank you for the detailed feedback! I’m glad to hear the blueprint is helpful for your use case!

Regarding your question about default_transition_length on ESPHome devices: You’re absolutely right that this can interfere with the intended effect when blink_duration is shorter than the device’s default transition time. This is a great observation, and adding a transition option to the blueprint is definitely possible.

I’ll look into adding a transition_length setting to the light control section of the blueprint. This way, you can explicitly define a shorter transition time, overriding the default transition of the ESPHome device, ensuring the effect is visible even with shorter durations.

Thanks again for pointing this out, and I’ll update the blueprint as soon as I can. Stay tuned!

1 Like