I have 2 Apple TVs conected with home assistant as media players.
What I am aiming is to have a notification on my mobile phone, that finds out which Apple TV started playing, and informs me about of the name of media being played, as well as the app playing this media.
Now, in the action part, if I put this code, it works fine:
service: notify.mobile_app_shadys_iphone
data:
message: >-
'{{ state_attr("media_player.lounge_apple_tv", "media_title") }}' is
playing from '{{ state_attr("media_player.lounge_apple_tv", "app_name")
}}' on Lounge tv!
But this will only show what is running one of the ‘lounge’ TV’, i deally I need the action to find out which Apple TV triggered the automation and starts pulling the required attributes. When I try to use this code, it shows ‘None’
service: notify.mobile_app_shadys_iphone
data:
message: >-
'{{ state_attr("trigger.to_state.entity_id", "media_title") }}' is playing
from '{{ state_attr("trigger.to_state.entity_id", "app_name") }}' on '{{
trigger.to_state.name }}'!
The question is:
What is the right syntax that will determine ‘the TV media player’ that triggered the automation, and get its attricutes? Thanks for your help.