This automation suite intelligently controls your living room lighting based on the playback status of your Plex media player (e.g. Plex running on a Samsung TV). It creates a cozy, cinema-like atmosphere by dimming the lights and turning off fans when a movie starts, and restoring full brightness and normal settings when the movie is paused or stopped. Smooth brightness transitions and system log messages keep you informed about the current state.
media_player entity for your Plex player (e.g., media_player.plex_plex_for_samsung_tv_2020).sensor.wohnzimmer_fernsehsender_name to extend functionality.How it works:
alias: Living Room Light Control Based on Plex Movie Status
description: >
  Controls living room lighting based on Plex playback state.
  - When playing: dims lights, turns off fan, logs event, then after 10 minutes
    turns off kitchen hood.
  - When paused/stopped/idle: restores full brightness and logs event.
triggers:
  # Trigger when Plex player changes state to playing
  - entity_id: media_player.plex_plex_for_samsung_tv_2020
    to: playing
    trigger: state
  # Trigger when Plex player leaves playing state to paused/off/idle
  - entity_id: media_player.plex_plex_for_samsung_tv_2020
    from: playing
    to:
      - paused
      - "off"
      - idle
    trigger: state
conditions: []
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: media_player.plex_plex_for_samsung_tv_2020
            state: playing
        sequence:
          - parallel:
              # Turn off bright ceiling and spotlight lights for cinema feel
              - target:
                  entity_id:
                    - light.a7936d80caa019ec2ce84a2c51c50a02
                    - light.1df39f453fd981ff0576529085067789
                    - light.05d30dfa72978e686a55cadeea7bcc50
                action: light.turn_off
                data: {}
              # Turn off the living room fan to minimize distractions
              - target:
                  entity_id: fan.250e37c9d2d41d709b36e1e775cf99
                action: fan.turn_off
                data: {}
              # Dim ambient lights to 25% brightness with smooth transition (3 seconds)
              - target:
                  entity_id:
                    - light.wohnzimmer_led_2
                    - light.tv_led
                    - light.stehlampe_led_2
                data:
                  brightness_pct: 25
                  transition: 3
                action: light.turn_on
              # Set a fan light to 10% brightness with smooth transition
              - target:
                  entity_id: light.han_fun_1_f1
                data:
                  brightness_pct: 10
                  transition: 3
                action: light.turn_on
              # Set bookshelf or accent light to 40% brightness with smooth transition
              - target:
                  entity_id: light.bcc7cc2e68a4318e8946e6674b617333
                data:
                  brightness_pct: 40
                  transition: 3
                action: light.turn_on
          # Log the lighting change to the Home Assistant system log for transparency
          - data:
              message: >-
                🎬 Movie started – lights dimmed, fan off, kitchen hood will turn off after 10 minutes.
              level: info
            action: system_log.write
          # Wait 10 minutes before turning off the kitchen hood to reduce noise gradually
          - delay: "00:10:00"
          # Turn off kitchen hood (exhaust fan) after delay
          - target:
              entity_id: switch.a77978ab818643c5455ae6563230f92b
            action: switch.turn_off
            data: {}
      - conditions:
          - condition: template
            value_template: |
              {{ trigger.to_state.state in ['paused', 'off', 'idle'] and
                 trigger.from_state.state == 'playing' }}
        sequence:
          - parallel:
              # Restore lights affected by movie mode to full brightness with smooth transitions
              - target:
                  entity_id:
                    - light.han_fun_1_f1
                    - light.wohnzimmer_led_2
                    - light.tv_led
                    - light.stehlampe_led_2
                data:
                  brightness_pct: 100
                  transition: 3
                action: light.turn_on
              # Turn on other lights that were turned off during movie mode
              - target:
                  entity_id:
                    - light.1df39f453fd981ff0576529085067789
                    - light.a7936d80caa019ec2ce84a2c51c50a02
                    - light.05d30dfa72978e686a55cadeea7bcc50
                    - light.bcc7cc2e68a4318e8946e6674b617333
                data: {}
                action: light.turn_on
          # Log the restoration to system log
          - data:
              message: ⏸️ Movie paused/stopped – lights set to 100%.
              level: info
            action: system_log.write
mode: restart
      entity_id) in the automation to match your exact smart home setup.mode: restart ensures the automation restarts cleanly if triggered multiple times quickly.sensor.wohnzimmer_fernsehsender_name) to trigger or condition the automation for better coverage.