Using "flash" with light.turn_on

I figured out that I can make a light flash via the Rest API by passing it something like:

{“entity_id”: “light.office_rgbw”, “flash”: “short”}

But I can’t figure out how to do this from a scene. If I try something like this, I get YAML parsing errors

  flashoffice:
    alias: 'Flash Office RGBW'
    sequence:
      - service: light.turn_on
        entity_id: light.office_rgbw
        flash: short

In a scene, where/how would I use flash? Or color effects, for that matter?

1 Like

try

flashoffice:
  alias: 'Flash Office RGBW'
  sequence:
    - service: light.turn_on
      data:
        entity_id: light.office_rgbw
        flash: short
2 Likes

You can probably also use a scene; https://home-assistant.io/components/scene/

@chrom3 's example did the trick. Thanks. I keep forgetting about data:

@Danielhiversen - when you say scene, do you mean sequencing the light on and off with delays?

Does the light need to “support” flashing or does HA do this internally with turn_on/off?
I have tried it with two different lights (my own yeelightsunflower platform and an mqtt_template) but it just turns on the lights and they stay on.
I’m using a script:

script:
  sphere_glow:
    alias: Sphere glow
    sequence:
      - alias: on
        service: light.turn_on
        data:
          entity_id: light.spheramid_underlight
          brightness: 155
          flash: short

Is this a config problem or a light capability issue?

1 Like

It appears to depend on the light having some built-in flash capability.

It works with my Hues and my MiLights, but not with my Zwave switches.

One thing I noticed - flash:short is a single flash, not a quick flash for a period of time. So make sure you’re near the light while testing.

You could achieve a similar effect with a script.

3 Likes

Thanks for the answer. It’s nice to know when you should stop trying :slight_smile:

I am trying to do the same with my fibaro dimmers z-wave, it just turns on and stay on, in the case of z wave the flashing is for an alarm situation (special message), i just haven’t rack how to send it from HA-Node-RED

here is the info (i know it applies to most dimmers in z wave)

Operating alarm data frames

FIBARO System allows user to set response of devices to alarm situations (response to data-frames ALARM_REPORT and SENSOR_ALARM_REPORT). Dimmer 2 responds to the following types of alarms:

  • General Purpose Alarm – GENERAL PURPOSE ALARM
  • Smoke Alarm – ALARM CO2, ALARM CO, ALARM SMOKE
  • Water Flooding Alarm – ALARM WATER
  • Temperature Alarm – ALARM HEAT

Alarm data-frames are sent by devices that are system sensors (e.g., flood sensors, smoke detectors, motion detectors, etc.).

The device may respond in the following manner to received data-frames (settings are configured in configuration parameters, see „Advanced parameters” on page 22):

0 – DEACTIVATION – the device does not respond to alarm data frames
1 – DIMMER 2 ON – the device turns on after detecting an alarm
2 – DIMMER 2 OFF – the device turns off after detecting an alarm
3 – ALARM FLASHING – the device periodically changes its status to the opposite when it detects an alarm (lights on/off alternately)

suggestions?.. anyone?

I hope this is still relevant. I cannot find an ‘official’ way to do it, so I just created a logical work around.

I used CHOOSE in the yaml:

Logic:
If Light is off:

  • Flash
  • Then Turn Off
    Else if Light is on
  • Flash
flash_notify:
  alias: Flash Notify
  sequence:
- choose:
    - conditions:
      - condition: device
        type: is_off
        device_id: xxxxxxx
        entity_id: light.yeelight_color_69
        domain: light
      sequence:
      - service: light.turn_on
        data:
          entity_id: light.yeelight_color_69
          flash: short
        entity_id: light.yeelight_color_69
      - delay: '1'
      - type: turn_off
        device_id: xxxxxxx
        entity_id: light.yeelight_color_69
        domain: light
    - conditions:
      - condition: device
        type: is_on
        device_id: xxxxxxx
        entity_id: light.yeelight_color_69
        domain: light
      sequence:
      - service: light.turn_on
        data:
          entity_id: light.yeelight_color_69
          flash: short
        entity_id: light.yeelight_color_69
    default: []
2 Likes

Thanks!

Where can i use this?