Bias Lights Automation Glitch and Possible Fixes

Hey everyone, I wanted to share my experience with setting up bias lighting for my TV using Hue lights. It’s been a fun project, but I’ve encountered a small glitch that I’m trying to figure out. Maybe someone here has a solution or a better approach!

So, I have a pair of Hue lights that I use as bias lighting. I set up an automation to turn them on when my Apple TV is in ‘playing’ or ‘idle’ mode and turn them off when it’s in ‘standby’ or ‘off’. It works most of the time, but occasionally, the Apple TV momentarily switches modes during playback, causing the lights to flicker off and back on. It’s a bit annoying, but I think it’s due to a glitch in Home Assistant somewhere.

One idea I had was to add a short delay to the turn-off action. If the Apple TV turns back on within the delay time, the lights would stay on. I created an automation for this, but I’m not sure if it’s the most efficient solution. Here’s what the automation looks like:

yaml
trigger:

  • platform: state
    entity_id:
    • media_player.bedroom
      to: idle
  • platform: state
    entity_id:
    • media_player.bedroom
      to: standby
      condition:
      action:
  • if:
    • condition: or
      conditions:
      • condition: state
        entity_id: media_player.bedroom
        state: idle
      • condition: state
        entity_id: media_player.bedroom
        state: playing
      • condition: state
        entity_id: media_player.bedroom
        state: paused
        then:
      • service: light.turn_on
        data:
        brightness_pct: 50
        kelvin: 6000
        target:
        entity_id: light.bias_lights
        else:
      • condition: or
        conditions:
        • condition: state
          entity_id: media_player.bedroom
          state: standby
        • condition: state
          entity_id: media_player.bedroom
          state: ‘off’
      • delay:
        hours: 0
        minutes: 0
        seconds: 10
        milliseconds: 0
      • service: light.turn_off
        data: {}
        target:
        entity_id: light.bias_lights
        mode: single

I’m wondering if there’s a simpler or more reliable way to achieve this. Maybe adjusting the delay or using a different condition? I’d love to hear your thoughts and suggestions!

Thanks in advance for your help!