feat: Add Shield TV to Media Package

This commit is contained in:
2024-12-30 10:28:47 -08:00
parent 4dc4f93453
commit 0e6b76e35a

View File

@@ -45,6 +45,91 @@ script:
data:
option: Idle
# Shield TV Input
#
# Very annoying since apps don't necessarily tell Android if they are playing
# (looking at you, Jellyfin) and we need two integrations to even get the full
# story for the Android TV base status.
#
# ATV (app ID) | Cast | JF | State
# ----------------------------|---------|---------|--------------------
# off (XX) | XX | XX | Idle (system off)
# on (com.spocky.projengmenu) | XX | XX | Idle (Projectivity Launcher)
# on (org.jellyfin.androidtv) | XX | idle | Stopped (Jellyfin Home)
# on (org.jellyfin.androidtv) | XX | playing | Playing (Jellyfin)
# on (org.jellyfin.androidtv) | XX | paused | Paused (Jellyfin)
# on (others) | idle | XX | Stopped (App Home)
# on (others) | playing | XX | Playing (App)
# on (others) | paused | XX | Paused (App)
#
- condition: "{{ state_attr('media_player.living_room_receiver', 'source') == 'SHIELD' }}"
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ is_state('media_player.shield_tv_living_room_atv', 'off') }}"
- condition: template
value_template: "{{ state_attr('media_player.shield_tv_living_room_atv', 'app_id') == 'com.spocky.projengmenu' }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Idle
- conditions: "{{ state_attr('media_player.shield_tv_living_room_atv', 'app_id') == 'org.jellyfin.androidtv' }}"
sequence:
- choose:
- conditions: "{{ is_state('media_player.shield_tv_living_room_jellyfin', 'playing') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Playing
- conditions: "{{ is_state('media_player.shield_tv_living_room_jellyfin', 'paused') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Paused
- conditions: "{{ is_state('media_player.shield_tv_living_room_jellyfin', 'idle') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Stopped
- conditions: "{{ is_state('media_player.shield_tv_living_room_cast', 'playing') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Playing
- conditions: "{{ is_state('media_player.shield_tv_living_room_cast', 'paused') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Paused
- conditions: "{{ is_state('media_player.shield_tv_living_room_cast', 'idle') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Stopped
# Roku Input
- conditions: "{{ state_attr('media_player.living_room_receiver', 'source') == 'Roku Ultra' }}"
sequence:
@@ -120,6 +205,12 @@ automation:
entity_id: media_player.living_room_receiver
- platform: state
entity_id: media_player.living_room_roku
- platform: state
entity_id: media_player.shield_tv_living_room_atv
- platform: state
entity_id: media_player.shield_tv_living_room_cast
- platform: state
entity_id: media_player.shield_tv_living_room_jellyfin
action:
- service: script.ht_player_state_update