The top row, controls some harmony activities, that turn on whatever devices I need for each one. They are then configured in home-assistant as switches. If you’ve not got a harmony remote I’m sure other methods could be used. As a minimum, you could have a switch for each device and turn on the ones you want manually.
The main section of controls just call a service to do whatever, there’s no other config supporting this, the service parameters are all in the card config and the service itself is for the harmony remote. Again, as long as you can use a service call of some type for each button, you can replace that fairly easily. If you need to use different services for different devices then use conditional cards to swap things in and out.
The bottom section is dependant on the AndroidTV config, a sensor containing the currently running app and a script, called by the buttons, to swap apps.
All the elements this depends on are in the code below.
#################################################
# Hamrony Remote Setup
#################################################
remote:
- platform: harmony
host: 192.168.1.69
name: lounge
activity: TV
switch:
- platform: template
switches:
lounge_tv:
friendly_name: Lounge TV
value_template: "{{ is_state_attr('remote.lounge', 'current_activity', 'SHIELD TV') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "SHIELD TV"
turn_off:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "PowerOff"
icon_template: >-
{% if is_state_attr('remote.lounge', 'current_activity', 'SHIELD TV') %}
mdi:television
{% else %}
mdi:television-off
{% endif %}
soundbar:
friendly_name: Soundbar
value_template: "{{ is_state_attr('remote.lounge', 'current_activity', 'Soundbar') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "Soundbar"
turn_off:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "PowerOff"
icon_template: >-
{% if is_state_attr('remote.lounge', 'current_activity', 'Soundbar') %}
mdi:music
{% else %}
mdi:music-off
{% endif %}
ps3:
friendly_name: PS4
value_template: "{{ is_state_attr('remote.lounge', 'current_activity', 'PS4') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "PS4"
turn_off:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "PowerOff"
icon_template: >-
{% if is_state_attr('remote.lounge', 'current_activity', 'PS4') %}
mdi:playstation
{% else %}
mdi:playstation
{% endif %}
usbc:
friendly_name: USB-C
value_template: "{{ is_state_attr('remote.lounge', 'current_activity', 'USB-C Cable') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "USB-C Cable"
turn_off:
service: remote.turn_on
data:
entity_id: remote.lounge
activity: "PowerOff"
icon_template: >-
{% if is_state_attr('remote.lounge', 'current_activity', 'USB-C Cable') %}
mdi:cellphone-play
{% else %}
mdi:cellphone
{% endif %}
#################################################
# Shield TV Setup
#################################################
media_player:
- platform: androidtv
name: Shield
host: 192.168.1.18
# adbkey: "/config/adbkey/adbkey"
device_class: androidtv
apps:
com.amazon.amazonvideo.livingroom: "PrimeVideo"
com.google.android.tvlauncher: "Home"
com.nvidia.bbciplayer: "iPlayer"
com.channel5.my5: "My5"
com.nousguide.android.rbtv: "RedBullTV"
com.google.android.music: "GooglePlayMusic"
air.ITVMobilePlayer: "ITVHub"
state_detection_rules:
"com.google.android.tvlauncher":
- "standby"
"com.amazon.amazonvideo.livingroom":
- "paused":
"wake_lock_size": 0
- "playing":
"wake_lock_size": 2
- "standby"
"com.nvidia.bbciplayer":
- "paused":
"wake_lock_size": 1
- "playing":
"wake_lock_size": 2
- "standby"
script:
launch_shield_app:
sequence:
- service: switch.turn_on
entity_id: switch.lounge_tv
- wait_template: "{{ is_state('switch.lounge_tv', 'on') }}"
timeout: "00:01:00"
continue_on_timeout: "false"
- service: androidtv.adb_command
data_template:
command: "{{ adbcommand }}"
entity_id: media_player.shield
sensor:
- platform: template
sensors:
cur_shield_app:
friendly_name: "Shield App"
value_template: "{{ state_attr('media_player.shield', 'app_name') }}"