#call_service turn on scene doesn't trigger another automation

1 messages · Page 1 of 1 (latest)

crude mauve
#

I have automations set for all my scenes to also trigger respective input booleans to "On" so that I know a scene is active.

I've now set up an automation which says "When the TV is turned off after 20:00 and the Movie Scene is active, change to the Evening Scene." It fires the scene as it should but for some reason the input boolean stays to off, even though the Evening automation says to turn it to on when the "turn on" service is called. Here's my code:

Scene change:

alias: Change to Evening Scene when TV is turned off
description: ""
trigger:
  - platform: device
    device_id: [device_id]
    domain: media_player
    entity_id: [entity_id]
    type: turned_off
condition:
  - condition: or
    conditions:
      - condition: time
        after: "18:00:00"
      - condition: state
        entity_id: input_boolean.scene_movie_activity
        state: "on"
action:
  - action: scene.turn_on
    data: {}
    target:
      entity_id: scene.evening
mode: single

Input boolean automation which I expect to run after the scene change:

alias: Evening Scene is ON
description: ""
trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: scene
      service: turn_on
      service_data:
        entity_id: scene.evening
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 150
  - action: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.scene_evening_activity
mode: single
#

I wonder if this is related to the renaming of "call service" under actions

stark olive
#

Why not just add the boolean switching as a second action in your first automation?

#

Or have all the relevant booleans as part of the scene so it gets set when the scene does its thing?

crude mauve
#

I guess I'll do that for now but I'll leave the thread open in case anyone knows why it doesn't

#

it's likely it has to do with "call service" now working differently under the actions

green dagger
#

Event triggering can be fickle in a lot of instances. @stark olive has the right idea. Personally, I'd rather keep all the logic for a particular action in a single automation/script as you get into a lot of dependancy hell when you start branching out into automations firing because another automation did something to something.

#

The KISS principal largely applies to things like this.

stark olive
limber swift
#

Try switching the entity_id to be a list in the trigger.

  - platform: event
    event_type: call_service
    event_data:
      domain: scene
      service: turn_on
      service_data:
        entity_id: 
          - scene.evening
crude mauve
crude mauve