Blinking Lights with Restore and Transition – Updated Blueprint
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.
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.
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 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
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!
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.
I’ve updated the blueprint to include a flexible trigger mechanism!
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!
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!
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
Hi everyone!
I’ve updated the Blinking Lights with Restore blueprint to make it more flexible and user-friendly. Here’s what’s new:
New Features
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.
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
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.
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.
Restoration:
After the blinking sequence completes, the lights return to their original state.
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.
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.
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.
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.
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 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.
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!