1
0
ansible-home-assistant/automations/3d-printer.yaml
2021-05-24 20:26:03 +02:00

66 lines
1.7 KiB
YAML

- id: 3dprinter-off
alias: '[3D Printer] Turn off'
mode: single
trigger:
- type: value
platform: device
device_id: 58e9b8fc848631004a3c1e303ff25229
entity_id: sensor.3d_printer_power
domain: sensor
below: 30
for:
hours: 0
minutes: 30
seconds: 0
condition:
- condition: state
entity_id: binary_sensor.octoprint_printing
state: 'off'
action:
- service: switch.turn_off
entity_id: switch.3d_printer_switch
- id: 3dprinter-on
alias: '[3D Printer] Turn on'
mode: single
trigger:
- platform: state
entity_id: switch.3d_printer_switch
to: 'on'
for: '00:00:05'
action:
- service: rest_command.octoprint_connect
- id: 3dprinter-button
alias: '[3D Printer] button'
mode: single
trigger:
- device_id: a2ac0fa69738b8e7c5c1b8b8bcf8cdc2
domain: zha
platform: device
type: remote_button_short_press
subtype: remote_button_short_press
action:
- choose:
- conditions:
- condition: state
entity_id: switch.3d_printer_switch
state: 'off'
sequence:
- service: switch.turn_on
target:
entity_id: switch.3d_printer_switch
- conditions:
- condition: state
entity_id: switch.3d_printer_switch
state: 'on'
- condition: state
entity_id: binary_sensor.octoprint_printing
state: 'off'
- condition: numeric_state
entity_id: sensor.3d_printer_power
below: '30'
sequence:
- service: switch.turn_off
target:
entity_id: switch.3d_printer_switch