121 lines
3.1 KiB
YAML
121 lines
3.1 KiB
YAML
- id: goto_sleep
|
|
alias: '[Behaviour] Go to sleep'
|
|
mode: single
|
|
trigger:
|
|
- platform: calendar
|
|
event: start
|
|
offset: '-9:35:0'
|
|
entity_id: calendar.automations_wakeup
|
|
- platform: calendar
|
|
event: start
|
|
offset: '-9:05:0'
|
|
entity_id: calendar.automations_wakeup
|
|
condition:
|
|
- condition: state
|
|
entity_id: binary_sensor.hulk_ping
|
|
state: 'on'
|
|
action:
|
|
- service: light.turn_on
|
|
data:
|
|
flash: long
|
|
rgb_color:
|
|
- 255
|
|
- 0
|
|
- 0
|
|
target:
|
|
entity_id: light.office_light_up
|
|
- service: notify.hulk
|
|
data:
|
|
title: "Sleep notifier"
|
|
message: "Go to sleep, computer will turn off in 5 minutes"
|
|
- delay: '0:05:00'
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.hulk_ping
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.pc_caffeine
|
|
state: 'off'
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.office_light_up
|
|
- service: shell_command.pc_poweroff
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.hulk_ping
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.pc_caffeine
|
|
state: 'on'
|
|
sequence:
|
|
- service: notify.hulk
|
|
data:
|
|
title: "Sleep notifier"
|
|
message: "You have 30 more minutes"
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.pc_caffeine
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.office_light_up
|
|
|
|
- id: goto_sleep_2
|
|
alias: '[Behaviour] Go to sleep (hard cutoff)'
|
|
mode: single
|
|
trigger:
|
|
- platform: calendar
|
|
event: start
|
|
offset: '-8:35:0'
|
|
entity_id: calendar.automations_wakeup
|
|
condition:
|
|
- condition: state
|
|
entity_id: binary_sensor.hulk_ping
|
|
state: 'on'
|
|
action:
|
|
- service: notify.hulk
|
|
data:
|
|
title: "Sleep notifier"
|
|
message: "Go to sleep, computer will be force turned off off in 5 minutes"
|
|
- service: light.turn_on
|
|
data:
|
|
flash: long
|
|
rgb_color:
|
|
- 255
|
|
- 0
|
|
- 0
|
|
target:
|
|
entity_id: light.office_light_up
|
|
- service: light.turn_on
|
|
data:
|
|
rgb_color:
|
|
- 255
|
|
- 0
|
|
- 0
|
|
target:
|
|
entity_id: light.office_light_up
|
|
- delay: '0:04:30'
|
|
- service: notify.hulk
|
|
data:
|
|
title: "Sleep notifier"
|
|
message: "30 seconds"
|
|
- delay: '0:00:20'
|
|
- service: notify.hulk
|
|
data:
|
|
title: "Sleep notifier"
|
|
message: "10 seconds"
|
|
- delay: '0:00:10'
|
|
- service: shell_command.pc_poweroff
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.pc_caffeine
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.office_light_up
|
|
- delay: '0:05:00'
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id: switch.computer_outlet
|