Home-AssistantConfig/automation/tv_time_on_and_off.yaml

68 lines
1.7 KiB
YAML
Executable File

######################################################################
## TV Time at sunset or 8pm. Whichever is later.
######################################################################
- alias: TV Time
trigger:
- platform: sun
event: sunset
offset: '+01:00:00'
- platform: state
entity_id: input_boolean.TV_time
state: 'on'
from: 'off'
- platform: state
entity_id: sensor.samsungtv
state: 'Online'
- platform: time
after: '20:00:00'
condition:
condition: and
conditions:
- condition: state
entity_id: group.family
state: home
- condition: state
entity_id: sensor.samsungtv
state: 'Online'
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.tv_time
- service: scene.turn_on
entity_id: scene.tv_time
######################################################################
## Turn off the Living room lights when the TV is turned off.
######################################################################
- alias: TV Time off
trigger:
- platform: state
entity_id: sensor.samsungtv
state: 'Offline'
condition:
condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
service: light.turn_off
entity_id:
- group.living_room
- group.living_room_accents