I have this automation which works as expected. The Moonlight app launches on the Apple TV at the end. (Ignore the silly conditions that’s legacy from when I had a more complex setup for this, need to change it)
alias: 'Entertainment: PC Streaming Start'
description: Wake Gaming PC & Living Room PC when PC Stream activity started
trigger:
- entity_id: remote.harmony_hub
platform: state
condition:
- condition: or
conditions:
- condition: template
value_template: >-
{{ is_state_attr(trigger.to_state.entity_id, 'current_activity', 'PC
Stream') }}
- condition: template
value_template: >-
{{ is_state_attr(trigger.to_state.entity_id, 'activity_starting', 'PC
Stream') }}
action:
- service: switch.turn_on
data: {}
entity_id: switch.gaming_pc
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: media_player.select_source
data:
source: Moonlight
target:
entity_id: media_player.living_room
mode: single
However the TV Clock app does not launch at the end of this one and I cannot figure out why. The trace shows the automation runs and if I add other actions to it they run, but the TV Clock app won’t launch. If I run the automation manually (or call the service the same way under Developer Tools) it works so I know the action is correct. I also tried quoting “TV Clock” because of the space but it just removes it and as said it still runs when triggered manually even with the space.
alias: 'Entertainment: Audio (Music) Start'
description: ''
trigger:
- entity_id: remote.harmony_hub
platform: state
attribute: current_activity
to: Apple TV Audio
condition: []
action:
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: media_player.select_source
data:
source: TV Clock
target:
entity_id: media_player.living_room
mode: single
Trace
Executed: February 19, 2022, 10:26:44 AM
Result:
params:
domain: media_player
service: select_source
service_data:
source: TV Clock
entity_id:
- media_player.living_room
target:
entity_id:
- media_player.living_room
running_script: false
limit: 10
Suggestions?