I have the following script that successfully triggers via the HA GUI:
mute_wait_unmute_lounge:
sequence:
- service: switch.turn_on
entity_id: switch.soundbar_mute
- delay:
seconds: 3.5
- service: switch.turn_off
entity_id: switch.soundbar_mute
However when I include it as part of the following automation, it fails to trigger:
# sessionStarted
- alias: "sessionStarted music_mode lounge (MUTE WAIT UNMUTE)"
trigger:
platform: mqtt
topic: hermes/dialogueManager/sessionStarted
condition:
- condition: template
value_template: "{{ trigger.payload_json['siteId'] == 'lounge' }}"
- condition: template
value_template: "{{ trigger.payload_json['customData'] == 'music_mode' }}"
# SOUNDBAR MUST BE ON MUSIC SOURCE FOR THIS TRIGGER TO INITIATE
- condition: template
value_template: "{{ is_state('switch.soundbar_power', 'on') }}"
- condition: template
value_template: "{{ is_state('switch.soundbar_music', 'on') }}"
action:
# MUTE FOR 3.5 SECS SO USER CAN SAY COMMAND THEN UNMUTE SO THAT THE MUSIC CAN BE HEARD
service: script.mute_wait_unmute_lounge
When I check via the HA GUI, the conditions required for the automation to work are true but the script fails to execute.
Does anyone have any idea what I am doing wrong?
Thanks