input_boolean: plex_dimmed_lights: name: Lights have been dimmed initial: off automation: - alias: Dim lights for movie action: - service: scene.turn_on entity_id: scene.dimmed_brightness - service: input_boolean.turn_on data: entity_id: input_boolean.plex_dimmed_lights trigger: - platform: state entity_id: media_player.plex_ps4 to: playing from: idle condition: - condition: state entity_id: light.living_room state: 'on' - condition: template value_template: >- {{ state_attr('media_player.plex_ps4', 'media_content_type') == 'movie'}} - alias: Restore lights after movie action: - service: scene.turn_on data_template: entity_id: >- {% if is_state('sun.sun', 'below_horizon') %} scene.nighttime_brightness {% else %} scene.normal_brightness {% endif %} - service: input_boolean.turn_off data: entity_id: input_boolean.plex_dimmed_lights trigger: - platform: state entity_id: media_player.plex_ps4 to: idle from: playing condition: - condition: state entity_id: light.living_room state: 'on' - condition: state entity_id: input_boolean.plex_dimmed_lights state: 'on' group: Plex: view: yes icon: mdi:television entities: - group.plex_players - group.plex_automations plex_players: name: Plex entities: - media_player.plex_ps4 plex_automations: name: Automations entities: - automation.dim_lights_for_movie - automation.restore_lights_after_movie