WTH is so difficult to make a light blink for a couple of seconds?

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?

I didn’t got you point, @AnvilPaladin. Aren’t those two links just the same?

Hey!

Sorry, let me try to clarify:

Maybe the redirect is confusing HA and causing it to fail?

Aha!
Now I got it! Thanks for clarifying.

What about these new links:

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

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

If this one works I will fix on all my previous posts.

1 Like

That did it! No more errors for me when trying to import either of them :slight_smile:

1 Like

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.)

4 Likes

@ 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 :smiley:

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

1 Like

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?

Blink should show up in Developer Tools as an effect if it’s available

1 Like

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 :wink:

Everything effect, but blink :rofl:

I’ll try it with one of my Hue bulbs.