I am using code that dims the living room lights when the media is playing on the TV, and when paused comes back to normal, which works well, I would like to add a light switch, so when media is playing the light is turned off and turn on when paused, how do i add, I cant seem to get it to work.
Automation Code
code
-
alias: “Media player paused/stopped”
trigger:- platform: state
entity_id: media_player.living_room_tv
from: ‘playing’
to: ‘off’ - platform: state
entity_id: media_player.living_room_tv
from: ‘playing’
to: ‘idle’ - platform: state
entity_id: media_player.living_room_tv
from: ‘playing’
to: ‘paused’
condition: []
#- condition: state
entity_id: sun.sun
state: ‘below_horizon’
action:
service: scene.turn_on
entity_id: scene.livingroom_normal - platform: state
-
alias: “Media player playing”
trigger:- platform: state
entity_id: media_player.living_room_tv
state: ‘playing’
condition: []
#- condition: state
entity_id: sun.sun
state: ‘below_horizon’
action:
service: scene.turn_on
entity_id: scene.livingroom_dim - platform: state
SCENE
scene:
-
name: Livingroom normal
entities:
light.chair:
state: on
transition: 5
brightness_pct: 100
light.garage_door:
state: on
transition: 5
brightness_pct: 100 -
name: Livingroom dim
entities:
light.couch:
state: on
transition: 5
brightness_pct: 30
light.garage_door:
state: on
transition: 5
brightness_pct: 30
The switch is switch.dinig_room
Thanks