I have strange problem. I made a configuration with UI and tried to change it in YAML… Got pretty close but have several problems.
The automation I made is triggered by a sensor and the yaml is:
(yaml)
alias: Flash Lights
description: ''
trigger:
- platform: state
entity_id: sensor.incidents
attribute: id
condition:
- condition: state
entity_id: light.livingcolors
state: 'on'
action:
- service: light.turn_on
entity_id: light.livingcolors
data:
entity_id: light.livingcolors
flash: long
rgb_color: [255,0,0]
- delay: '5'
- scene: scene.standard_livingroom
mode: single
What I want is that light flashes long in color red when the sensor is triggered. Because I think the FLASH Short is too short and the FLASH LONG is too long I made the delay of 5 seconds before going back to scene.standard_livingroom.
The return to the scene is needed because otherwise the light stays red.
The condition to do above is when the light is already on. And now comes the strange part: when the light is off part of the automation is triggered. It flashes long, but not for 5 seconds and not in red. Just the color of the standard living room scene.
Ideally I want:
If light.livincolors is on then
flash long in red for 5 seconds and return to standard scene
else
Turn light.livincolors on
flash long in red for 5 seconds and return to standard scene
Turn light.livincolors off