Trigger on scene activation stopped working

We have a scene that can be activated by a button state or via Alexa. There are several things I want to happen when that scene is called. I created this automation some time ago and it stopped working on 27 Nov. Here’s the trigger:

platform: event
event_type: call_service
event_data:
  domain: scene
  service: turn_on
  service_data:
    entity_id: scene.good_night

Why would this stop working? I have verified the name and the scene is clearly activated. Automation shows it’s not been triggered in weeks (should be triggered when we go to bed each night).

entity_id as list works for me:


platform: event
event_type: call_service
event_data:
  domain: scene
  service: turn_on
  service_data:
    entity_id:
      - scene.anrichte_szene_color_burst

Strange.

Thinking @pedolsky was on to something, I was testing again this morning with a test scenario. Logic was telling me there was some bug with the YAML format. Created a new scene and automation to detect it.

alias: Testing yaml for event
description: ""
trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: scene
      service: turn_on
      service_data:
        entity_id: scene.testing_testing_testing
condition: []
action:
  - service: light.toggle
    data:
      flash: short
    target:
      entity_id: light.office_lamp_2
mode: single

That works?!? Yet my same code above refuses to work. WTF?

I changed the entity_id to a single element list and will see what happens tonight.

I had the same experience trying your first scenario with one of my existing scenes. Cannot understand this behaviour because when you look into the event data, it’s a one-liner as you used it.

Maybe the event is not always fired? You could always change it to a state trigger on the scene, that should work too. But I agree the above should work also.

I flagged @pedolsky as the solution here, but to summarize, changing the trigger from this:

platform: event
event_type: call_service
event_data:
  domain: scene
  service: turn_on
  service_data:
    entity_id: scene.good_night

to this…

platform: event
event_type: call_service
event_data:
  domain: scene
  service: turn_on
  service_data:
    entity_id: 
      - scene.good_night

…resolved the problem. I have a bug report open with HA core. Why this suddently changed back in late November? I have a theory it was when I upgraded HA and the code is handling it differently and/or it’s modifying the structure. Still does not explain why a pre-existing automation does not work with the single element and a new one does.

This issue reminds me of another one (involving events) from long ago (but can’t find the related topic right now).

If I remember it correctly, the related issue went something like this:

The first time the event occurs after startup, the entity’s entity_id is reported as a string. Afterwards it’s reported as a list. This string/list duality caused problems for detection with an Event Trigger.

I don’t recall a solution other than avoiding the use of an Event Trigger (if feasible) and relying on a State Trigger.