1
0
ansible-home-assistant/scripts/30.pc-sleep.yaml

47 lines
1.3 KiB
YAML
Raw Normal View History

2021-05-24 22:10:22 +00:00
pc_sleep:
alias: PC Sleep
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.desktop
state: 'on'
- condition: state
entity_id: input_boolean.pc_caffeine
state: 'off'
sequence:
- service: shell_command.pc_suspend
- service: input_boolean.turn_on
target:
entity_id: input_boolean.pc_sleeping
- conditions:
- condition: state
entity_id: binary_sensor.desktop
state: 'off'
sequence: [ ]
default:
mode: single
icon: mdi:desktop-tower-monitor
pc_safe_off:
alias: PC Safe Off
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.desktop
state: 'on'
sequence:
- service: shell_command.pc_poweroff
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.desktop
to: 'off'
- service: switch.turn_off
target:
entity_id: switch.computer_outlet
default: [ ]
- service: switch.turn_off
target:
entity_id: switch.computer_outlet
mode: single
icon: mdi:desktop-tower-monitor