I have my receiver set up in HA. Everything works fine manually, but now I want to automate things. For example, switching the input and changing the volume works fine, but I’m stuck on how to conditionally turning my receiver on first.
What I want to do is something like:
if (states.media_players.radio == "off") {
- service: media_player.turn_on
- data:
- entity_id: media_player.radio
- delay:
seconds: 10
}
- service: media_player.volume_set
- data:
- entity_id: media_player.radio
- volume_level: 0.1
- service: media_player.select_source
- data:
- entity_id: media_player.radio
- source: "TUNER"
How should I do this in a proper way? Conditions don’t seem to be an option here, since I want the script to resume and not quit. The only examples of using if/else templates seem to work on simple attributes and not entire “code blocks”.