1
0
ansible-home-assistant/configuration/automations/3d-printer.yaml

158 lines
4.2 KiB
YAML

- id: 3dprinter_off
alias: '[3D Printer] Turn off'
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.3d_printer_electric_consumption_w
below: 30
for: '00:30:00'
condition:
- condition: state
entity_id: sensor.prusa_mk39
state: 'Idle'
action:
- service: switch.turn_off
target:
entity_id:
- switch.3d_printer
- switch.3d_printer_enclosure_fan_on_off
- service: light.turn_off
entity_id: light.3d_printer_light
- id: 3dprinter_notify
alias: '[3D Printer] Notify'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
from: 'Printing'
to: 'Idle'
action:
- service: notify.mobile_app_iphone
data:
message: 3D printer has finished
data:
entity_id: camera.3d_printer
url: "/lovelace-tablet/3d-printer"
- service: camera.snapshot
data:
filename: /config/www/cctv/3d_printer.jpg
target:
entity_id: camera.3d_printer
- service: notify.home_assistant
data:
message: "3D Printer has finished"
target: [ "1070521797688180796" ]
data:
images:
- "/config/www/cctv/3d_printer.jpg"
- 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
state: 'off'
sequence:
- service: switch.turn_on
target:
entity_id: switch.3d_printer
- service: light.turn_on
entity_id: light.3d_printer_light
- conditions:
- condition: state
entity_id: switch.3d_printer
state: 'on'
- condition: state
entity_id: sensor.prusa_mk39
state: 'Idle'
- condition: numeric_state
entity_id: sensor.3d_printer_electric_consumption_w
below: '30'
sequence:
- service: switch.turn_off
target:
entity_id:
- switch.3d_printer
- switch.3d_printer_enclosure_fan_on_off
- service: light.turn_off
entity_id: light.3d_printer_light
- id: 3dprinter_fan_on
alias: '[3D Printer] Fan on'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
from: 'Idle'
to: 'Printing'
condition:
- condition: numeric_state
entity_id: sensor.prusa_mk39_heatbed_target_temperature
below: '100'
action:
- service: switch.turn_on
target:
entity_id: switch.3d_printer_enclosure_fan_on_off
- id: 3dprinter_fan_off
alias: '[3D Printer] Fan off'
mode: single
trigger:
- platform: state
entity_id:
- binary_sensor.octoprint_printing
condition:
- condition: numeric_state
entity_id: sensor.prusa_mk39_heatbed_target_temperature
above: '99'
action:
- service: switch.turn_off
target:
entity_id: switch.3d_printer_enclosure_fan_on_off
- id: 3dprinter_pause_notify
alias: '[3D Printer] Notify about paused print'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39_nozzle_target_temperature
to: "0"
condition:
- condition: numeric_state
entity_id: sensor.prusa_mk39_heatbed_target_temperature
above: 0
action:
- service: notify.mobile_app_iphone
data:
title: Prusa MK3.9
message: 3D Print has been paused
data:
entity_id: camera.3d_printer
url: "/lovelace-tablet/3d-printer"
- id: 3dprinter_pause_notify_2
alias: '[3D Printer] Notify about paused print (test)'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
to: "Paused"
action:
- service: notify.mobile_app_iphone
data:
title: Prusa MK3.9
message: 3D Print has been paused
data:
entity_id: camera.3d_printer
url: "/lovelace-tablet/3d-printer"