Scene snapshot works first time, but not a second time?

Hi, I have recently tried to improve an automation I have where I flash lights in my house to remind me to put the bins out. The automation is intended to change the lights to the colour of the relevant bin for 3 seconds, and then put the lights back to their original state.

FWIW: I am running supervisor-2021.03.3 / core-2021.3.0

The behaviour I see however, is that when I start with no scene, the automation works as expected - in the snippet below, the lights change from their current state to green for 3 seconds and then back to their original state.

However, if I then re-run the automation (via the run actions from the automation page), the lights change to green again, and never change back.

I have tried various version of HA over the last month or so, read forums, tweaked config, and am at a loss on how to further troubleshoot my issue, and would love some help/suggestions.

I am also wondering if having the lights grouped together (light.lounge_room) and used in other scripts/integrations might somehow be impacting this?

Possible relevant parts of my config:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

logger:
  default: warning
  logs:
    homeassistant.components.scene: debug


scene: !include scenes.yaml

scenes.yaml:

[]

Automation below:

- id: '1595317464144'
  alias: 'Lounge: (bins) - set lights for green bin'
  description: ''
  trigger:
  - at: '21:00'
    platform: time
  condition:
  - condition: state
    entity_id: sensor.green_bin
    state: '0'
  action:
  - service: scene.create
    data:
      snapshot_entities:
      - light.lounge_light_tv_end
      - light.lounge_light_window_end
      scene_id: before
  - data:
      scene_name: Green bin
    service: script.1592721230266
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - scene: scene.before

script:

'1592721230266':
  alias: Set Lounge Room lights to mode
  sequence:
  - data:
      group_name: Lounge room
    data_template:
      scene_name: '{{scene_name}}'
    service: hue.hue_activate_scene
  mode: single

Finally, the logs show nothing related to scenes at all (so the log config for debug does not seem to shed further light on this).

$ sudo grep scene home-assistant.log 
2021-03-05 11:09:39 INFO (MainThread) [homeassistant.components.scene] Setting up scene.homeassistant
2021-03-05 11:09:46 INFO (MainThread) [homeassistant.components.scene] Setting up scene.tahoma
1 Like

Same here man. SAME. The snapshot works fine for 2, 3 ou 5 times, maybe… and then the lights get stuck and don’t return to the original state.
Whether I find something I’ll be back to explain to you. Please do the same. Hope to see you soon.

Hi Pedro,

I can’t recall which version of home assistant, but about 3-6 months ago, this has just worked perfectly time after time. I’ve included my current yaml in case it helps, its tied to a hue light, so it has pre-defined hue lighting scenes that change the light color (lounge_room_green_bin). The other scene setting, comes from the scene.create and then using it.

Hope this helps

alias: "Lounge: (bins) - set lights for green bin"
description: ""
trigger:
  - at: "21:00:00"
    platform: time
condition:
  - condition: state
    entity_id: calendar.green_bin
    state: "on"
action:
  - service: scene.create
    data:
      snapshot_entities:
        - light.lounge_room
      scene_id: lounge_light_b4
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.lounge_room_green_bin
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.lounge_light_b4
mode: single

Forgot to add, I am now on version: 2023.12.3