1
0
ansible-home-assistant/scripts/30.pc-sleep.yaml
2021-05-25 00:10:22 +02:00

47 lines
1.3 KiB
YAML

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