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

207 lines
5.3 KiB
YAML

- id: prusa_mk39_off
alias: '[Prusa MK3.9] Turn off'
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.3d_printer_electric_consumption_w
below: 30
for: '00:15:00'
condition:
- condition: or
conditions:
- condition: state
entity_id: sensor.prusa_mk39
state: finished
- condition: state
entity_id: sensor.prusa_mk39
state: idle
action:
- service: switch.turn_off
target:
entity_id:
- switch.3d_printer
- service: fan.turn_off
target:
entity_id:
- fan.esp_3dprinter_controller_mk4_exhaust
- service: light.turn_off
entity_id: light.3d_printer_light
- id: prusa_mk39_first_layer
alias: '[Prusa MK3.9] First layer'
mode: single
trigger:
- platform: numeric_state
entity_id:
- sensor.prusa_mk39_z_height
above: 0.25
condition:
- condition: state
entity_id: sensor.prusa_mk39
state: printing
action:
- service: camera.snapshot
data:
filename: /config/www/cctv/3d_printer.jpg
target:
entity_id: camera.3d_printer
- service: notify.home_assistant
data:
message: "Prusa MK3.9 First Layer"
target: [ "1070521797688180796" ]
data:
images:
- "/config/www/cctv/3d_printer.jpg"
- id: prusa_mk39_notify_finished
alias: '[Prusa MK3.9] Notify Finished'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
from: printing
to: finished
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: prusa_mk39_button
alias: '[Prusa MK3.9] 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
- service: fan.turn_off
target:
entity_id:
- fan.esp_3dprinter_controller_mk4_exhaust
- service: light.turn_off
entity_id: light.3d_printer_light
- id: prusa_mk39_fan_on
alias: '[Prusa MK3.9] Fan on'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
from: idle
to: printing
condition:
- condition: or
conditions:
- condition: state
entity_id: sensor.prusa_mk39_material
state: PLA
- condition: state
entity_id: sensor.prusa_mk39_material
state: PETG
action:
- service: fan.turn_on
target:
entity_id: fan.esp_3dprinter_controller_mk4_exhaust
- id: prusa_mk39_nevermore_on
alias: '[Prusa MK3.9] Nevermore on'
mode: single
trigger:
- platform: state
entity_id:
- sensor.prusa_mk39
to: printing
condition:
- condition: or
conditions:
- condition: state
entity_id: sensor.prusa_mk39_material
state: ABS
- condition: state
entity_id: sensor.prusa_mk39_material
state: ASA
- condition: state
entity_id: sensor.prusa_mk39_material
state: PC
- condition: state
entity_id: sensor.prusa_mk39_material
state: PCTG
action:
- service: fan.turn_on
target:
entity_id: fan.esp_3dprinter_controller_mk4_nevermore
data:
- id: prusa_mk39_fan_off
alias: '[Prusa MK3.9] Fan off'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
from: printing
to: idle
action:
- service: fan.turn_off
target:
entity_id: fan.esp_3dprinter_controller_mk4_exhaust
- id: prusa_mk39_pause_notify
alias: '[Prusa MK3.9] Notify about paused print'
mode: single
trigger:
- platform: state
entity_id: sensor.prusa_mk39
from: printing
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"