1
0
ansible-home-assistant/configuration/automations/bedroom-tv.yaml

90 lines
2.0 KiB
YAML

- id: bedroom_tv_on
alias: '[Bedroom] TV On'
trigger:
- platform: state
entity_id: media_player.bedroom_tv
to: 'on'
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
action:
- service: script.bedroom_tv_scene
- id: bedroom_tv_off
alias: '[Bedroom] TV Off'
trigger:
- platform: state
entity_id: media_player.bedroom_tv
to: 'off'
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
action:
- service: script.bedroom_tv_off_scene
- id: bedroom_tv_turn_off_at_night
alias: '[Bedroom] TV turn off at night'
mode: single
trigger:
- platform: state
entity_id: input_select.home_mode
to: Night
for:
minutes: 60
- platform: state
entity_id: media_player.bedroom_tv
to: "on"
for:
minutes: 60
condition:
- condition: state
entity_id: input_select.home_mode
state: 'Night'
action:
- service: media_player.turn_off
target:
entity_id: media_player.bedroom_tv
- id: bedroom_tv_off_at_night
alias: '[Bedroom] TV stay off at night'
mode: single
trigger:
- platform: state
entity_id: media_player.bedroom_tv
to: 'on'
condition:
- condition: time
before: "09:00:00"
after: "01:30:00"
action:
- service: media_player.turn_off
target:
entity_id: media_player.bedroom_tv
- service: switch.turn_off
target:
entity_id: media_player.bedroom_tv
- service: light.turn_off
entity_id:
- light.bedroom_lights
- light.bed_lightstrip
- light.bed_lamps
- id: bedroom_lamp_off_at_night
alias: '[Bedroom] Turn off lamps at night'
mode: single
trigger:
- platform: state
entity_id:
- media_player.bedroom_tv
to: "off"
for:
hours: 0
minutes: 5
seconds: 0
action:
- service: light.turn_off
target:
entity_id: light.bed_lamps