I created two scenes, and they are working well.
Now, I want to automate them, but I run into an issue :
alias: TV Samsung Salon éteinte
trigger:
- platform: state
entity_id: media_player.samsung_q60_series_65
from: "off"
to: "on"
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
service: scene.turn_on
entity_id: scene.movie_playing
alias: TV Samsung Salon allumée
trigger:
- platform: state
entity_id: media_player.samsung_q60_series_65
to: "off"
from: "on"
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
service: scene.turn_on
entity_id: scene.movie_not_playing_anymore
alias: Dim lights when playing TV after sunset
description: ""
Still, I see no “On” attribute when I use the visual editor ! strange isn’t it ?
I guess I’d rather point this thing to my plex media player entity, directly ?
Bonus question : can I also make netflix, disney plus, etc. appear as media_players ?
EDIT: I’ve changed from my my samsung device to the shield pro device, which actually do send “Playing” attributes. I’ll see how it works tonight (too lazy to remove the sunset condition to test it now)
EDIT 2: indeed, it is important to use a media_player_* that shoots "playing. it now works great ! here is the final code:
alias: "Light Scene : Dim lights when TV is turned on after sunset"
description: ""
trigger:
- platform: state
entity_id:
- media_player.android_tv_192_168_3_49
to: playing
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
enabled: true
action:
- service: scene.turn_on
target:
entity_id: scene.movie_playing
metadata: {}
mode: single
and to go back to normal:
alias: "Light Scene : Turn lights back to normal when TV is turned off after sunset"
description: ""
trigger:
- platform: state
entity_id:
- media_player.android_tv_192_168_3_49
from: playing
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
enabled: true
action:
- service: scene.turn_on
target:
entity_id: scene.movie_not_playing_anymore
metadata: {}
mode: single