Skip to content

Instantly share code, notes, and snippets.

@b-turchyn
Last active March 10, 2023 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-turchyn/f36ad994cb8bc79f6ee0e088a211dcb8 to your computer and use it in GitHub Desktop.
Save b-turchyn/f36ad994cb8bc79f6ee0e088a211dcb8 to your computer and use it in GitHub Desktop.
Home Assistant Automation - Turn Off TV When It's Too Late
alias: Turn Off TV When It's Too Late
description: ""
trigger:
- platform: state
entity_id:
- media_player.living_room_tv
for:
hours: 0
minutes: 0
seconds: 0
from: "off"
- platform: time
at: "21:00:00"
condition:
- condition: time
after: "21:00:00"
weekday:
- mon
- tue
- wed
- thu
- sun
before: "00:00:00"
enabled: true
- condition: not
conditions:
- condition: device
device_id: aea7ed024f65467cb57386622a1649fa
domain: media_player
entity_id: media_player.living_room_tv
type: is_off
action:
- service: media_player.turn_off
data: {}
target:
device_id: aea7ed024f65467cb57386622a1649fa
- service: media_player.volume_set
target:
device_id: abeb9841cac8c0275dceb5e994f13958
data:
volume_level: 0.75
- service: tts.google_say
data:
entity_id: media_player.kitchen_speaker
message: Go to bed! You want to wake up early, remember?
cache: true
language: en-au
- wait_for_trigger:
- platform: device
device_id: abeb9841cac8c0275dceb5e994f13958
domain: media_player
entity_id: media_player.kitchen_speaker
type: idle
- service: media_player.media_stop
target:
device_id: abeb9841cac8c0275dceb5e994f13958
data: {}
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment