Automatically close the Curtains when the TV turns on

In my house it's really difficult to see the TV during the day if the curtains are open because of the glare that comes in via the window. To combat this I've created an automation to automatically close the curtain as soon as the TV is switched on.

In this example I will show you an automation that closes a curtain when it detects that the TV has been switched on. You can easily adapt this automation to close any other type of Cover device. A cover in Home Assistant is any curtain, blind, awning or garage door device.

To create this automation you will need:

  1. A working Home Assistant installation

  2. A Smart Television that is integrated with Home Assistant and allows you to detect if it is on or off. I have an LG Smart TV that does this.

  3. Some automated curtain or blind controllers set up in Home Assistant as Cover entities

Trigger

This automation is triggered when the television goes from off to on using a State trigger.

Screenshot of Home Assistasnt that shows the automation trigger that is triggered when the TV turns on.

Here is the sunset automation trigger in YAML format:

platform: state
entity_id: media_player.living_room_tv
from: 'off'
to: 'on'

Condition

I do not use a condition in this automation.

Action

This automation uses a Service call action to call the cover.close service and closes the Living Room Curtain

Screenshot showing Home Assistant service call that closes the living room curtain.

Full Automation in YAML

alias: 'Curtain: Close living room curtain when TV turns on'
description: ''
mode: single
trigger:
  - platform: state
    entity_id: media_player.living_room_tv
    from: 'off'
    to: 'on'
condition: []
action:
  - service: cover.close_cover
    target:
      entity_id: cover.living_room_curtain
Previous
Previous

Trigger a Home Assistant automation when your phone alarm goes off

Next
Next

Automatically open and close Curtains and Blinds at Sunrise, Sunset or any other time