Iv been trying to call a switch when my tv goes into app mode, here is what i have tried using examples iv found:
automation switch to kodi:
alias: Switch to kodi input
trigger:
platform: state
from: ‘HDMI 1’
to: ‘App’
entity_id: media_player.sony_tv
action:
service: switch.turn_on
entity_id:
- switch.kodi_input_amp
automation switch to tv:
alias: Switch to TV input
trigger:
platform: state
from: ‘App’
to: ‘HDMI 1’
entity_id: media_player.sony_tv
action:
service: switch.turn_on
entity_id:
- switch.tv_input_amp
The switch that it calls send an ir command to my amp, so id like to be able to switch to the relevant input based on what state my tv is in.
The first 2 automations above work if i trigger them, but they havent been triggered automatically yet,
Do you use a specific input when you go to App mode, or could it be from any of your input’s? Thinking maybe you could track the change from/to “HDMI 1” or “HDMI 2”
like yllar said it’s under the media_content_id or the media_title. But you may need to check and see if it’s on first. Those attributes disappear if the tv isn’t on.
automation switch to tv:
alias: Switch to tv input
trigger:
platform: template
value_template: “{{ is_state_attr(‘media_player.sony_tv’, ‘media_title’, ‘HDMI 1’) }}”
action:
service: switch.turn_on
entity_id: switch.tv_input_amp
Now i want to switch the input to hdmi 1 on my tv when i switch my switch.tv_input_amp on - basically closing the app im using on my tv.
Iv only created my own switches so far, haven’t tested many of the components. But i can see and set HDMI 1 using the sony bravia component using the input selector, so would i just call the input_select.xxx ?