All scenes going unavailable after editing any scene, help!

Hi everyone. I’ve been creating scenes for different light setups and also for calling devices in the Tuya ecosystem (which is not easily compatible with Home Assistant unless you create scenes). A couple of weeks ago I was looking for ways to activate a scene within a scene, and I found a post saying you could create an automation that is triggered by an empty scene, and the automation can call other scenes.

image

Lately I noticed that every time I save any scene (from Settings > Automations & Scenes > Scenes) all of my “scene triggered by scene” are activated at the same time.

I checked in the event listener and found that every time I edit and save a scene, all scenes go unavailable and their state changes many times in a row, and this causes this automation to trigger

I created this automation because I needed a scene that could call other scenes, and the “solution” was to create an automation triggered by an empty scene.
Now I need to limit this automation to only be triggered when I actually click the scene, not when other scenes are modified! Any ideas?

Any help would be appreciated!
Thanks,
Rodrigo

1 Like

Every time you save a scene in the UI editor it calls scene.reload. This reloads the scene integration which causes every scene to be unloaded from HA and then reloaded from its config. That’s literally why the save button in the UI works. There is no way to avoid this, they are all going to go unavailable when you save one.

What you need to do instead is in your automation trigger add not_to and not_from like this:

trigger:
  - platform: state
    entity_id: scene.empty_scene
    not_to: 'unavailable'
    not_from: 'unavailable'

This way it will still trigger your auotmation every time the scene is turned on. But it will ignore state changes going to or coming from unavailable so it stops triggering on reload.

1 Like

Thank you very much @CentralCommand ! This was driving me a bit crazy :laughing: