From 30dec7589f0b51d119055458140c353072a901fe Mon Sep 17 00:00:00 2001 From: pgrondek Date: Sat, 3 Apr 2021 22:55:49 +0200 Subject: [PATCH] Add androidtv --- automations/files/configuration.yaml | 25 +++++ automations/files/scripts/android-tv.yaml | 111 ++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 automations/files/scripts/android-tv.yaml diff --git a/automations/files/configuration.yaml b/automations/files/configuration.yaml index ac08098..18082bc 100644 --- a/automations/files/configuration.yaml +++ b/automations/files/configuration.yaml @@ -42,6 +42,31 @@ influxdb: alarm_control_panel: - platform: manual +media_player: + - platform: androidtv + name: nVidia Shield + device_class: androidtv + host: 192.168.60.18 + adbkey: "/config/android/adbkey" +# exclude_unnamed_apps: true + apps: + com.google.android.leanbacklauncher: AndroidTV Launcher + com.netflix.ninja: Netflix + com.liskovsoft.smarttubetv.beta: SmartTube + tv.twitch.android.app: Twitch + org.mozilla.firefox: Firefox + com.tvp.vodtv.tv: TVP VOD + pl.redefine.ipla: IPLA + com.amazon.amazonvideo.livingroom: Prime Video + eu.hbogo.androidtv.production: HBO GO + state_detection_rules: + 'com.netflix.ninja': + - 'media_session_state' + 'com.amazon.amazonvideo.livingroom': + - 'media_session_state' + 'eu.hbogo.androidtv.production': + - 'media_session_state' + spotify: client_id: !secret spotify_client_id client_secret: !secret spotify_client_secret diff --git a/automations/files/scripts/android-tv.yaml b/automations/files/scripts/android-tv.yaml new file mode 100644 index 0000000..ce2830a --- /dev/null +++ b/automations/files/scripts/android-tv.yaml @@ -0,0 +1,111 @@ +tv_nintendo_switch: + alias: Nintendo Switch + icon: 'mdi:nintendo-switch' + sequence: + - service: switch.turn_on + entity_id: switch.harmonyhub_play_a_game + - service: media_player.select_source + data: + source: TV + target: + entity_id: media_player.living_room +tv_twitch: + alias: Twitch + icon: 'mdi:twitch' + sequence: + - choose: + - conditions: + - condition: state + entity_id: switch.harmonyhub_shield_tv + state: 'off' + sequence: + - service: switch.turn_on + entity_id: switch.harmonyhub_shield_tv + - service: media_player.select_source + data: + source: TV + target: + entity_id: media_player.living_room + - delay: 5 + - service: media_player.select_source + data: + source: Twitch + target: + entity_id: media_player.nvidia_shield +tv_youtube: + alias: YouTube + icon: 'mdi:youtube' + sequence: + - choose: + - conditions: + - condition: state + entity_id: switch.harmonyhub_shield_tv + state: 'off' + sequence: + - service: switch.turn_on + entity_id: switch.harmonyhub_shield_tv + - service: media_player.select_source + data: + source: TV + target: + entity_id: media_player.living_room + - delay: 5 + - service: media_player.select_source + data: + source: YouTube + target: + entity_id: media_player.nvidia_shield +tv_netflix: + alias: Netflix + icon: 'mdi:netflix' + sequence: + - choose: + - conditions: + - condition: state + entity_id: switch.harmonyhub_shield_tv + state: 'off' + sequence: + - service: switch.turn_on + entity_id: switch.harmonyhub_shield_tv + - delay: 5 + - service: media_player.select_source + data: + source: TV + target: + entity_id: media_player.living_room + - service: media_player.select_source + data: + source: Netflix + target: + entity_id: media_player.nvidia_shield +tv_firefox: + alias: Firefox + icon: 'mdi:firefox' + sequence: + - choose: + - conditions: + - condition: state + entity_id: switch.harmonyhub_shield_tv + state: 'off' + sequence: + - service: switch.turn_on + entity_id: switch.harmonyhub_shield_tv + - delay: 5 + - service: media_player.select_source + data: + source: TV + target: + entity_id: media_player.living_room + - service: media_player.select_source + data: + source: Firefox + target: + entity_id: media_player.nvidia_shield +tv_off: + alias: 'TV Off' + icon: 'mdi:power' + sequence: + - service: switch.turn_off + entity_id: switch.harmonyhub_play_a_game + - service: switch.turn_off + entity_id: switch.harmonyhub_shield_tv