You are right as usual, @123. As I add lights and reduce the delay it starts behaving really odd, but most likely for blinking a couple of lights in a not so short interval it would work fine.
FWIW, the same situation occurs when attempting to emulate transition
. There are scripts that ramp brightness and they work reasonably well with a light or two. However, as you’ve discovered for emulating flash
, increasing the number of lights can cause erratic behavior due to substantially increased zigbee network traffic.
That’s why transition
and flash
are implemented exclusively for devices that support the features natively.
A side point to consider when changing the state of lights… there may be other automations tied to the changing state of the light(s). You run the risk of causing a cascade of other actions.
This is among the reasons some lighting systems have a specifically separate security or flashing state, so something that tracks the light being turned on, or off, won’t misinterpret the flashing as repeated on/off changes.
Hello @EdwardTFN! I’m trying to import this blueprint into my HA and it shows an error saying “No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.”
I also tried to copy and paste this into a script (Scripts > Add Script) and it says “Message malformed: extra keys not allowed @ data[‘blueprint’]”.
I’m really interested in implementing this method in my HA, could you point me on the right steps to follow?
Thank you!
Rodrigo
I don’t know why the original links are failing,mbut please try those (using GitHub instead):
Please let me know if you still having issues with those links.
I tried with both links and they show this message:
In the meantime, I was able to import another script using the same method, so it seems that the problem is with these specific URLs…
R.
Mmmm…
Those 2 links are working for me.
Let me investigate a bit more…
I got the link working by following what the My integration was passing along and it’s redirecting to https://raw.githubusercontent.com/edwardtfn/ha_blueprints/main/script/EdwardTFN/blink_lights.yaml (the automation link). Maybe the links need corrected to point to the raw.githubusercontent.com domain?
Hey!
Sorry, let me try to clarify:
- When I click on the import button then open it in HomeAssistant, it gives the link https://github.com/edwardtfn/ha_blueprints/raw/main/script/EdwardTFN/blink_lights.yaml to HomeAssistant
- When I open that link directly (outside of HA), it redirects me to https://raw.githubusercontent.com/edwardtfn/ha_blueprints/main/script/EdwardTFN/blink_lights.yaml
Maybe the redirect is confusing HA and causing it to fail?
Aha!
Now I got it! Thanks for clarifying.
What about these new links:
If this one works I will fix on all my previous posts.
That did it! No more errors for me when trying to import either of them
By looking at your automation and your script to blink lights, I can see it uses mode: single
, which means multiple simultaneous executions will be ignored. I imagine this is probably fine if each script/automation instance only controls a single subset of the lights. However, if someone tries to be “smarter” and make the script (or automation) take the lights as parameters, then we are in trouble.
For me, this is yet another example of a subtle way things can go wrong because there is no native support for blinking in HA core. Which is yet another argument in favor to what I asked in the top of this thread.
(Note: I have nothing against you, @EdwardTFN, and nothing against your blueprints.) (Note 2: I haven’t had time to try your blueprints, and thus haven’t tried under those racing conditions.)
@ EdwardTFN Thanks for the blueprints. I can’t get the script blueprint to show any inputs though. I suspect fields
should be input
?
Edit:
Something like this? https://gitlab.com/filmkorn/ha_blueprints/-/raw/main/blink_lights.yaml
For anyone reading - light.toggle
is unreliable. if your lights support it, use light.turn_on service’s flash
option.
wow, what a journey
The problem I had:
- Some light stay on when I used any kind of flash or toggle automation
I see in the logs from zigbee2mqtt that homeassistant always send a “on” plus the effect. So I end up with sending mqtt messages:
alias: MqttBlink
description: ""
trigger:
- type: turned_on
platform: device
device_id: yyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxx
entity_id: uuuuuuuuuuuuuuxxxxxxxxxxxxxxxxxx
domain: binary_sensor
condition:
- condition: time
after: "06:00:00"
before: "21:00:00"
action:
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010yyyyyyy/set
#Light_Hall
payload: "{\"effect\":\"blink\"}"
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010ggggggg/set
#Light_LivR_Couch
payload: "{\"effect\":\"blink\"}"
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010uuuuuuu/set
#Light_My_Own_McDonalds_in_Basement
payload: "{\"effect\":\"blink\"}"
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010xxxxxxx/set
#Light_Catroom
payload: "{\"effect\":\"blink\"}"
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010448a00a/set
#Light_Kinddom_Garden
payload: "{\"effect\":\"blink\"}"
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010ppppppp/set
#Light_Fireplace
payload: "{\"effect\":\"blink\"}"
- service: mqtt.publish
data:
topic: zigbee2mqtt/0x001788010wwwwwww/set
#Light_Restroom
payload: "{\"effect\":\"blink\"}"
mode: queued
max: 5
This works very good!
But because my next plan is to used special color-codes with flash, I think I need a kind of state-memory where the automation can revert then…
If you have no blink effect you can also use toggle with some delay:
alias: Kind-of-a-Light-Flash
description: ""
trigger:
- type: turned_on
platform: device
device_id: yyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxx
entity_id: uuuuuuuuuuuuuuxxxxxxxxxxxxxxxxxx
domain: binary_sensor
condition:
- condition: time
after: "06:00:00"
before: "21:00:00"
action:
- service: light.toggle
data: {}
target:
device_id:
- iiiiiiiiiiyyyyyyxxxxxxxxxxxxxxxx
- gggggggggggggggghhhhhhhhhhhhhhhh
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 700
- service: light.toggle
data: {}
target:
device_id:
- iiiiiiiiiiyyyyyyxxxxxxxxxxxxxxxx
- gggggggggggggggghhhhhhhhhhhhhhhh
mode: queued
max: 5
How do I know if my light supports it? Will there be an error in the logs if I try to use it and the light doesn’t support it? Or will the problem be silently ignored? Is there a difference in behavior/implementation of flash
between zigbee vs wifi lightbulbs?
Alright, so it isn’t there on my list of effects:
I was asking because I’ve tried to use flash
on the lightbulb, but it didn’t work → and yet I haven’t seen any error or nothing, so I wasn’t sure if it’s me, or the HA, or the lightbulb
Everything effect, but blink
I’ll try it with one of my Hue bulbs.