Hi,
I have a basic “dim the lights when media is played” automation/scene. I want to add a second condition that the scene only run if the media type is a movie. However adding the second condition causes the scene not to run. Not sure what I’m doing wrong. below is both the working and non working code.
Mike
Working Automation:
### Movie Lights ###
- alias: "Media player paused/stopped"
trigger:
- platform: state
entity_id: media_player.xboxone
from: 'playing'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: scene.turn_on
entity_id: scene.familyroom_normal
- alias: "Media player playing"
trigger:
- platform: state
entity_id: media_player.xboxone
to: 'playing'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: scene.turn_on
entity_id: scene.familyroom_dim
Automation with second condition:
### Movie Lights ###
- alias: "Media player paused/stopped"
trigger:
- platform: state
entity_id: media_player.xboxone
from: 'playing'
condition:
condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: template
value_template: '{{ states.media_player.xboxone.attributes.media_content_type == movie }}'
action:
service: scene.turn_on
entity_id: scene.familyroom_normal
- alias: "Media player playing"
trigger:
- platform: state
entity_id: media_player.xboxone
to: 'playing'
condition:
condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: template
value_template: '{{ states.media_player.xboxone.attributes.media_content_type == movie }}'
action:
service: scene.turn_on
entity_id: scene.familyroom_dim