When pressing doorbell lights are flashing

I am trying to attempt the following:
When the (Skybell 2.0) doorbell is pressed, I want to flash a light for a short amount of time.
This is the config I have set up:

  - alias: 'doorbell flashing lights'
    trigger:
      - platform: state
        entity_id: binary_sensor.skybell_front_door_button
        to: 'on'
    action:
  - data:
      entity_id: light.fibaro_system_fgd212_dimmer_2_level_6
      flash: short
    service: light.turn_on

It doesn’t work. What do I need to change to get it working? I’ve tried it with both a Fibaro dimmer and a hue light bulb.

Edit: formatting code

Please format your code. In its current form, no one can confirm it is indented correctly.

To format your code, use one of these two techniques:

  • Select your code and use the </> icon.
  • Alternately, enter three back-quotes ``` on a separate line before your code and another three on a separate line after your code.

Thank you. Changed it.

Indenting is wrong for all lines below action.

Should be like this:

  - alias: 'doorbell flashing lights'
    trigger:
      - platform: state
        entity_id: binary_sensor.skybell_front_door_button
        to: 'on'
    action:
      - service: light.turn_on
        data:
          entity_id: light.fibaro_system_fgd212_dimmer_2_level_6
          flash: short
       

I would be curious if you got this working as you wanted it to. I tried to do some automations based on Skybell button and the motion, but the events received by Home Assistant were very delayed.

When I test the automation @ Services, the automation works. Tomorrow during daytime I will press the button of the Skybell and see if the automation is quick enough.

This is the code I am using.

- alias: 'doorbell flashing lights'
trigger:
  - platform: state
    entity_id: binary_sensor.skybell_front_door_button
    to: 'on'
action:
  - service: light.turn_on
    data:
      entity_id: light.rechts
      rgb_color: [224,1,102]
      flash: short
  - service: light.turn_on
    data:
      entity_id: light.links
      rgb_color: [224,1,102]
      flash: short    

What I want to find out is how I can turn the lights back to the initial state as before the automation started. I’m testing it with Hue lightbulbs.

When you run an automation from the Services page, it skips the automation’s trigger and condition sections and simply executes the action.

BTW, the code you posted still contains indenting errors. If I attempt to use it exactly as it’s shown it fails to pass Config Check.

Screenshot%20from%202019-06-19%2021-12-32

Everything below the first line is incorrectly indented (the image below is from Visual Studio Code editor). Those lines need to be indented by an additional 2 spaces (i.e. alias, trigger, and action should be aligned vertically).
Screenshot%20from%202019-06-19%2021-13-13

That first part I did not know. Thanks for that.

As for the code. I took it over like you mentioned it. When I press the validate-button, it’s all good. Is there a difference in the yaml config and the build in config over the web page? Lately I’ve been using the web configurator. Before I used Brackets to change the yaml files.

Below the code as it is, copied out of the yaml file:

  - alias: 'doorbell flashing lights'
    trigger:
      - platform: state
        entity_id: binary_sensor.skybell_front_door_button
        to: 'on'
    action:
      - service: light.turn_on
        data:
          entity_id: light.rechts
          rgb_color: [224,1,102]
          flash: short
      - service: light.turn_on
        data:
          entity_id: light.links
          rgb_color: [224,1,102]
          flash: short

Now your example is properly indented.

You said you wanted to:

turn the lights back to the initial state as before the automation started

Have you considered doing that using an automation that triggers when binary_sensor.skybell_front_door_button changes state from on to off?

Yes that part I know! But for example with the hue lights, when flashing a certain colour (doorbell rings) the bulbs stay that colour afterwards. Instead I want them back to soft white just like normal. That part I don’t know how to “code”.

If someone has a source on this or knows how to make this happen, please let me know.

I don’t know the rgb_color for ‘soft white’. However, if we refer to the CSS Color chart, the colorname called ‘floralwhite’ is 255,250,240. You can experiment with these rgb values to get something that approximates ‘soft white’.

The action, of whatever automation your are using to turn off the light, would set the color back to white before turning off the light.

    action:
      - service: light.turn_on
        data:
          entity_id: light.rechts, light.link
          rgb_color: [255,250,240]
      - service: light.turn_off
        data:
          entity_id: light.rechts, light.link

I don’t have a light that supports color changes so I can’t test this for you. In theory, it should work.

@stephano90 is this still working for you? Below is my config, but it doesn’t seem to work when the button is pressed. I can manually execute the automation and lights turn on, but its like the “to:” is wrong or something, idk.

  alias: Doorbell lights on
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.skybell_front_door_button
    to: 'on'
  condition: []
  action:
  - service: switch.turn_on
    data: {}
    entity_id: switch.led_lights
  mode: single