adjust the room lights when the TV goes on and off – Home Assistant

This tutorial serves as an introduction to Home Assistant ‘automations’ where smart devices often find their best uses. What follows can also be done in most other ‘smart home hubs’ such as Alexa, Google Home or Apple Home. ‘Automations’ are better known as ‘routines’ and they make quite unrelated devices interact with each other as below.

the premise: when it’s TV watching time you want background lighting instead of main room lighting. When the TV goes off you maybe want the opposite of this but whatever you prefer, you’ll make a smart home ‘routine’ or ‘automation’ to work as required. You need one or two smart room lights (or smart switches) and a smart TV for this. This summarises what the Home Assistant automation does:

  • waits for a smart TV and/or TV sound system and/or media player to turn on
  • turns on any combination of smart lamps or smart switches or table lights or adjusts the brightness of room lighting.
  • checks the time of day/night eg if it’s daytime in my case I don’t want the lights changed. This is easily adjustable to your use case.
  • does a ‘bedtime routine’ such as turn off all the lights eg 20 minutes after the TV goes off – or checks the time of day/night and turns off all the lights

in this post:

  • what you need
  • how to create this Home Assistant automation
  • example automation to turn on the ambient lighting and turn off the main lighting when the TV goes on
  • example automation to turn on the main lighting when the TV goes off
  • other ways round this

what you’d need for this

You need a TV connected to your network, plus a smart switch or smart lamp. All of these may be automatically ‘discovered’ or manually added to Home Assistant or whatever smart hub you use. In essence your lights and your TV should be listed in your Alexa or Home Assistant or Google or Apple Home apps. For example, below are the devices I’ve used at home:

how to create this Home Assistant automation

  • from the dashboard side panel go to Settings > Automations > Create automation
  • under When … add TRIGGER choose Entity. Look for media player entities related to TV. Below I’ve chosen the TV entity and my amplifier entity. Below this enter the state change from ‘off to ‘on’.
  • under And if … add Condition choose Time. Enter the time when the lights are expected to turn on or be ignored.
  • under Then do … add Action choose Light or Switch. Choose Turn on or off. Choose the light entity that needs changing.
  • if you want the lights to not stay on forever under Then do … add Action search for delay/wait for time to pass. Enter how long the lights stay on.
  • under Then do … add Action choose Light or Switch. Choose Turn off. Choose the light entity that needs changing.

example automation to turn on the ambient lighting and turn off the main lighting when the TV goes on


example automation to turn off the ambient lighting and turn on the main lighting when the TV goes off


there are other ways to do this

If you can’t find your internet connected TV in your smart home automation hub you may need to actively add it. For example, a TV may need the manufacturer’s app or other integration to be added before it can be discovered.

If your TV isn’t connected to the internet (so allowing it to be discovered) you may be able to monitor the state of your other devices (FireTV; Roku; set top box) to trigger lighting changes. A smart socket with energy monitoring allows Home Assistant to detect TV on/off via energy use.

There are special TV remote controls, such as Logitech Harmony Hub, that can be set to control lights.

There are LED light strips that come on and off with the TV and this may be what you’re looking for. Some actually splash the image colour on the TV to the wall – see this video to find the models that do this less expensively (than Philips hue).

Leave a Reply

Your email address will not be published. Required fields are marked *