I’d like my xbox to be switched off with the same button that turns my lights off, only when my relax scene is active. When that scene isn’t active, I want the xbox to not be touched at all.
In order to achieve this, I tried to template a blank entity ID based on the input_boolean used to indicate the relax scene is active, however, this is causing errors and then leading to the script only running up to that point and ignoring the remainder of the actions. As an example:
lounge_off:
sequence:
- service: light.turn_off
data_template:
entity_id: "{% if is_state('input_boolean.lounge_relax_activated', 'on') %}\n\
\ light.kitchen_light, light.lounge_light, light.floorlamp, light.hall_light\n{% else %}\n\
\ light.lounge_light, light.floorlamp\n{% endif %}\n"
- service: media_player.turn_off
data_template:
entity_id: "{% if is_state('input_boolean.lounge_relax_activated', 'on') %} media_player.xboxone {% elif %} '' {% endif %}"
- service: input_boolean.turn_off
entity_id: input_boolean.lounge_relax_activated
- service: switch.turn_off
entity_id: switch.salt_lamp
Would not execute steps after the xbox whenever it would return ‘’ for entity ID.
Is there a better way to only have service: media_player.turn_off only execute when my relax scene is activated?
Thanks!!