Hello dear community,
I am trying to setup a simple automation that when something happens the state of the of a Shelly RGBW should be snapshot into a scene, than a scene to let the LED flash is loaded and afterwards the saved scene should be restored.
I searched for similar examples before asking and found out that adding a delay after creating the snapshot helped other people, but it does not seem to be my case.
I ran the automation directly to debug it and I see that a new scene is created, the LEDs are flashed but after the delay of 5 seconds they are turned off without restoring the saved state. I even tried turning the LEDs on before running the automation, but nonetheless they are turned off at the end of the automation and if I check the configuration of the Shelly in the web UI I still see the red light state. To me it seems that the state of the Shelly is not saved correctly. I also tried increasing the first delay to 5 seconds, but nothing changed.
Here is the yaml of my automation:
alias: Alarm
description: Flash LEDs
triggers:
- type: opened
device_id: c1962cbbbbd5e4aa4a530136cb096edd
entity_id: 4d0af1183f046e0cb5d6d4a33a727dd6
domain: binary_sensor
trigger: device
conditions:
- alias: Somebody is in the room
condition: or
conditions:
- condition: device
device_id: 097ea2f0b420cdd14e856d7968dddfa5
domain: media_player
entity_id: 199c8e3c48e9f2b4997255c2e4740c82
type: is_on
- condition: device
type: is_on
device_id: 1714887379bbd9bfcc4adf624c0bfb82
entity_id: a899e0a8a7a712f30b88d6fd3c924a84
domain: light
- condition: device
type: is_on
device_id: dbe6e311d5c99017ca398e221b8af0e3
entity_id: a04b1dac0d47d36fb47579e124babc5e
domain: light
actions:
- sequence:
- alias: Save the state
action: scene.create
metadata: {}
data:
scene_id: saved_led_status
snapshot_entities:
- light.shelly_rgb
- delay: 2
- alias: Active red light scene
action: scene.turn_on
target:
entity_id: scene.red_light
data: {}
- delay: 5
- alias: Restore the previous state
action: scene.turn_on
target:
entity_id: scene.saved_led_status
data: {}
mode: single
Do you spot an error?
Thanks for your support.