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:
A working Home Assistant installation
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.
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.
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
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