Home-AssistantConfig/automation/tv_time_on_and_off.yaml
2017-04-21 01:58:13 +00:00

81 lines
2.0 KiB
YAML
Executable File

######################################################################
## TV Time at sunset or 8pm. Whichever is later.
######################################################################
- alias: TV Time
trigger:
- platform: state
entity_id: input_boolean.TV_time
state: 'on'
from: 'off'
- platform: state
entity_id: sensor.samsungtv
state: 'Online'
from: 'Offline'
- platform: state
entity_id: sun.sun
state: 'below_horizon'
from: 'above_horizon'
- platform: state
entity_id: media_player.living_room
state: 'playing'
from: 'idle'
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: light.turn_off
entity_id:
- group.dinette_lights
- group.kitchen_lights
- service: switch.turn_on
entity_id: switch.kitchen_accents
- 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_lights
- group.living_room_accents