I’ve been trying at this for a few days now…not sure whats going on. Essentially I use an input_select to keep track of which media device I am currently using (my TV has a Kodi Box for Live TV, Roku for Netflix/Hulu and Chromecast for music/misc). I would like to have a ‘smart pause’ button that directs a pause signal to the correct device. I think it should look something like this:
brendans_bedroom_media_pause: sequence: - service: script.turn_on data: entity_id: > {% if states.input_select.brendan_bedroom_active_media_player.state == "Roku" %} script.brendans_roku_play_pause {%-elif states.input_select.brendan_bedroom_active_media_player.state == "Chromecast" %} script.brendans_chromecast_play_pause {%-elif states.input_select.brendan_bedroom_active_media_player.state == "Kodi" %} script.brendans_kodi_play_pause {% else %} script.brendans_roku_play_pause {% endif %}
I’ve also tried:
brendans_bedroom_media_pause: sequence: - service: script.turn_on data: entity_id: > {% if is_state("input_select.brendan_bedroom_active_media_player.state", "Roku") %} script.brendans_roku_play_pause {%-elif is_state("input_select.brendan_bedroom_active_media_player.state", "Chromecast") %} script.brendans_chromecast_play_pause {%-elif is_state("input_select.brendan_bedroom_active_media_player.state", "Kodi") %} script.brendans_kodi_play_pause {% else %} script.brendans_roku_play_pause {% endif %}
As a reference point, the ‘else’ condition doesn’t seem to work as well, and none of the scripts are running.