Skip to content

Instantly share code, notes, and snippets.

@ax42
Last active May 3, 2018 21:21
Show Gist options
  • Save ax42/fef373334b761d82f939c9553c514c8a to your computer and use it in GitHub Desktop.
Save ax42/fef373334b761d82f939c9553c514c8a to your computer and use it in GitHub Desktop.
Hassio 3dprinter configs
- alias: "3d-printer: Hue Light 1 on for printing"
trigger:
platform: state
entity_id: sensor.octoprint_current_state, light.hue_color_lamp_1
condition:
- condition: state
entity_id: sensor.octoprint_current_state
state: "Printing"
action:
- service: light.turn_on
entity_id: light.hue_color_lamp_1
data:
brightness: 255
kelvin: 4800
- service: notify.slack
data:
message: "Kept Hue lamp on due to printing"
- alias: "3d-printer: Hue Light 1 off after printing"
trigger:
platform: state
entity_id: sensor.octoprint_current_state
from: "Printing"
action:
- service: light.turn_off
entity_id: light.hue_color_lamp_1
- service: notify.slack
data:
message: "Switched Hue lamp off after printing"
- alias: "3d-printer: Shutdown OctoPi if Prusa idle for 30 minutes"
trigger:
platform: state
entity_id: sensor.octoprint_current_state
to: "Operational"
for:
minutes: 30
action:
- service: notify.slack
data:
message: "Prusa idle for 30 minutes, shutting down OctoPi"
- alias: "3d-printer: Switch off 3d printing setup if OctoPi unreachable for 10 minutes"
trigger:
platform: state
entity_id: binary_sensor.octopi_ping
to: "off"
for:
minutes: 10
action:
- service: switch.turn_off
entity_id: switch.mystrom04
- service: notify.slack
data:
message: "OctoPi unreachable for 10 minutes, switching off power"
- platform: ping
host: <IP address>
name: Octopi Ping
scan_interval: 10
camera:
- platform: mjpeg
name: OctoPrint
mjpeg_url: http://<IP>:8080/?action=stream
still_image_url: http://<IP>:8080/?action=snapshot
- platform: octoprint
name: OctoPrint
monitored_conditions:
- Current State
- Temperatures
- Job Percentage
- platform: template
sensors:
mystrom04power:
friendly_name: "Mk3 power"
unit_of_measurement: "Watts"
value_template: '{{ states.switch.mystrom04.attributes["current_power_w"] }}'
icon_template: mdi:flash
- platform: command_line
switches:
octopi:
# friendly_name: "Mk3 and Pi Switch"
command_off: "ssh -v -o StrictHostKeyChecking=false -i /config/id_rsa pi@192.168.1.170 'sudo /sbin/shutdown -h now'"
value_template: '{{ states("binary_sensor.octopi_ping") == "on" }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment