Hi everyone again, I have an automation on play and pause that works, but now I’m trying to make start it only with certain android apps and not all, can you give me a look and make me understand where am I wrong?
Thank you.
automations.yaml
# SOGGIORNO
- alias: GoogleTV soggiorno paused
trigger:
- entity_id: media_player.android_castsoggiorno
from: playing
platform: state
- entity_id: remote.harmony_soggiorno
platform: state
attribute: current_activity
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: template
value_template: >
{{ is_state_attr('remote.harmony_soggiorno', 'current_activity', 'Watch GoogleTV' ) }}
- condition: template
value_template: >
{{ is_state_attr('media_player.android_castsoggiorno', 'app_name') in [ 'Amazon Prime Video', 'Plex', 'Netflix', 'Disney+', 'HDHomeRun' ] }}
action:
service: scene.turn_on
entity_id: scene.soggiorno_pausa
- alias: GoogleTV soggiorno play
trigger:
- entity_id: media_player.android_castsoggiorno
to: playing
platform: state
- entity_id: remote.harmony_soggiorno
platform: state
attribute: current_activity
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: template
value_template: >
{{ is_state_attr('remote.harmony_soggiorno', 'current_activity', 'Watch GoogleTV' ) }}
action:
service: scene.turn_on
entity_id: scene.soggiorno_spenta
- alias: GoogleTV soggiorno off
trigger:
- entity_id: remote.harmony_soggiorno
platform: state
attribute: current_activity
to: 'PowerOff'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: template
value_template: "{{ is_state_attr('remote.harmony_soggiorno', 'current_activity', 'PowerOff' ) }}"
action:
- service: scene.turn_on
entity_id: scene.soggiorno_normale
- alias: GoogleTV soggiorno on
trigger:
- entity_id: remote.harmony_soggiorno
platform: state
attribute: current_activity
from: 'PowerOff'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: template
value_template: "{{ is_state_attr('remote.harmony_soggiorno', 'current_activity', 'Watch GoogleTV' ) }}"
action:
- service: scene.turn_on
entity_id: scene.soggiorno_spenta
# TAVERNA
- alias: GoogleTV taverna paused
trigger:
- entity_id: media_player.android_casttaverna
from: playing
platform: state
- entity_id: remote.harmony_taverna
platform: state
attribute: current_activity
condition:
- condition: template
value_template: >
{{ state_attr('remote.harmony_taverna', 'current_activity') in [ 'Project GoogleTV' ] }}
action:
service: scene.turn_on
entity_id: scene.taverna_pausa
- alias: GoogleTV taverna play
trigger:
- entity_id: media_player.android_casttaverna
to: playing
platform: state
- entity_id: remote.harmony_taverna
platform: state
attribute: current_activity
condition:
- condition: template
value_template: >
{{ state_attr('remote.harmony_taverna', 'current_activity') in [ 'Project GoogleTV' ] }}
action:
service: scene.turn_on
entity_id: scene.taverna_spenta
- alias: GoogleTV taverna off
trigger:
- entity_id: remote.harmony_taverna
platform: state
attribute: current_activity
to: 'PowerOff'
condition:
- condition: template
value_template: "{{ is_state_attr('remote.harmony_taverna', 'current_activity', 'PowerOff' ) }}"
action:
- service: scene.turn_on
entity_id: scene.taverna_normale
- delay: 00:02:30
- service: switch.turn_off
entity_id: switch.accessory_mss310_main_channel
- service: switch.turn_off
entity_id: switch.media_center_mss310_main_channel
- alias: GoogleTV taverna on
trigger:
- entity_id: remote.harmony_taverna
platform: state
attribute: current_activity
from: 'PowerOff'
condition:
- condition: template
value_template: >
{{ is_state_attr('remote.harmony_taverna', 'current_activity') in [ 'Project GoogleTV', 'Project PC', 'Project Wii', 'Project Xbox 360', 'Project Retro Console', 'Projector' ] }}
- condition: template
value_template: >
{{ is_state_attr('media_player.android_castsoggiorno', 'app_name') in [ 'Amazon Prime Video', 'Plex', 'Netflix', 'Disney+', 'HDHomeRun' ] }}
action:
- service: scene.turn_on
entity_id: scene.taverna_spenta
config.yaml
#androidTV
media_player:
- platform: androidtv
scan_interval: 5
name: Android CastSoggiorno
device_class: androidtv
host: !secret CastSoggiorno_IP
exclude_unnamed_apps: true
apps:
com.google.android.apps.tv.launcherx: "Home"
com.google.android.youtube.tv: "Youtube"
com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
com.plexapp.android: "Plex"
com.netflix.ninja: "Netflix"
com.disney.disneyplus: "Disney+"
com.spotify.tv.android: "Spotify"
com.valvesoftware.steamlink: "Steam"
com.silicondust.view: "HDHomeRun"
state_detection_rules:
'com.amazon.amazonvideo.livingroom':
- 'playing':
'wake_lock_size': 3
- 'standby':
'wake_lock_size': 1
'com.netflix.ninja':
- 'playing':
'media_session_state': 3
'wake_lock_size': 2
- 'paused':
'media_session_state': 2
'wake_lock_size': 0
- 'standby':
'media_session_state': 1
'wake_lock_size': 0
'com.plexapp.android':
- 'standby':
'wake_lock_size': 0
'com.disney.disneyplus':
- 'playing':
'media_session_state': 3
'wake_lock_size': 3
- 'paused':
'media_session_state': 2
'wake_lock_size': 1
- 'standby':
'wake_lock_size': 1
'com.silicondust.view':
- 'playing':
'media_session_state': 3
'wake_lock_size': 3
- 'paused':
'media_session_state': 2
'wake_lock_size': 1
- 'standby':
'media_session_state': 0
'wake_lock_size': 1
- platform: androidtv
name: Android CastCucina
device_class: androidtv
host: !secret CastCucina_IP
exclude_unnamed_apps: true
apps:
com.google.android.apps.tv.launcherx: "Home"
com.google.android.youtube.tv: "Youtube"
com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
com.plexapp.android: "Plex"
com.netflix.ninja: "Netflix"
com.disney.disneyplus: "Disney+"
com.spotify.tv.android: "Spotify"
com.valvesoftware.steamlink: "Steam"
com.silicondust.view: "HDHomeRun"
- platform: androidtv
scan_interval: 5
name: Android CastTaverna
device_class: androidtv
host: !secret CastTaverna_IP
exclude_unnamed_apps: true
apps:
com.google.android.apps.tv.launcherx: "Home"
com.google.android.youtube.tv: "Youtube"
com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
com.plexapp.android: "Plex"
com.netflix.ninja: "Netflix"
com.disney.disneyplus: "Disney+"
com.spotify.tv.android: "Spotify"
com.valvesoftware.steamlink: "Steam"
com.silicondust.view: "HDHomeRun"
state_detection_rules:
'com.amazon.amazonvideo.livingroom':
- 'playing':
'wake_lock_size': 3
- 'standby':
'wake_lock_size': 1
'com.netflix.ninja':
- 'playing':
'media_session_state': 3
'wake_lock_size': 2
- 'paused':
'media_session_state': 2
'wake_lock_size': 0
- 'standby':
'media_session_state': 1
'wake_lock_size': 0
'com.plexapp.android':
- 'standby':
'wake_lock_size': 0
'com.disney.disneyplus':
- 'playing':
'media_session_state': 3
'wake_lock_size': 3
- 'paused':
'media_session_state': 2
'wake_lock_size': 1
- 'standby':
'wake_lock_size': 1
'com.silicondust.view':
- 'playing':
'media_session_state': 3
'wake_lock_size': 3
- 'paused':
'media_session_state': 2
'wake_lock_size': 1
- 'standby':
'media_session_state': 0
'wake_lock_size': 1
- platform: androidtv
name: Android CastStudio
device_class: androidtv
host: !secret CastStudio_IP
exclude_unnamed_apps: true
apps:
com.google.android.apps.tv.launcherx: "Home"
com.google.android.youtube.tv: "Youtube"
com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
com.plexapp.android: "Plex"
com.netflix.ninja: "Netflix"
com.disney.disneyplus: "Disney+"
com.spotify.tv.android: "Spotify"
com.valvesoftware.steamlink: "Steam"
com.silicondust.view: "HDHomeRun"
- platform: androidtv
name: Android CastCameretta
device_class: androidtv
host: !secret CastCameretta_IP
exclude_unnamed_apps: true
apps:
com.google.android.apps.tv.launcherx: "Home"
com.google.android.youtube.tv: "Youtube"
com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
com.plexapp.android: "Plex"
com.netflix.ninja: "Netflix"
com.disney.disneyplus: "Disney+"
com.spotify.music: "Spotify"
com.valvesoftware.steamlink: "Steam"
com.silicondust.view: "HDHomeRun"