Octoprint setup, UI, scripts and automations

found them :slight_smile:
clock-start and clock-end

2 Likes

Here is my setup to shutdown when extruder temperature has hit a certain point (vs. just timed):

- id: '1597548579610'
  alias: Turn Off 3D Printer After Complete
  trigger:
  - entity_id: binary_sensor.octoprint_printing
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - wait_template: '{{ states(''sensor.octoprint_actual_tool0_temp_c'')|int < 40 }}'
  - data: {}
    entity_id: switch.sonoff_a
    service: switch.turn_off
  - data: {}
    entity_id: switch.sonoff_b
    service: switch.turn_off
  mode: single
1 Like

Hi, Great Work.

I was just wondering, is there a way to wake up the raspberry pi running octoprint from within HASSIO??

Home assistant has a wake-on-lan switch that wakes up compatible devices by sending packets.

I don’t know if octoprint supports it tho.
You ll also have to use the Lan port, I don’t think WoL works with wifi.
Looks like rpis don’t support WoL at all. You ll have to go the smart outlet way.

1 Like

Hey Harry,

I would like to integrate the Xiaomi Temp/Humidity sensor (with its gateway) as well but cannot find the gateway V1 anymore, I read that the API key for V2 or 3 tot can be subtracted. Which gateway do you have?

Hey Andre,
I had some trouble trying to find a compatible gateway.
I bought a current one (1y ago?) and it didn’t work, so I gave it to a friend.
I was lucky and found two old China market pieces in a shop in my city (Athens, Greece) that actually worked.

I don’t remember the exact product code and I’m not home right now but I’m certain I’ve posted about it here.

I’ll look it up and let you know.

Edit:
Here’s my post on that issue.

DGNWG05LM was the EU version that didn’t work.
DGNWG02LM are the two CN versions that I still use.

By the way, all that was back in January. I don’t know what the current situation is :slight_smile:

That’s great I am looking forward to it (
Ζεστή στέγη)

Is there a Greek pun there? :smile:
I’m afraid I don’t get it :frowning:

As for our subject, I gave you the model codes above :slight_smile:

I know, I searched already at Ali but can’t find the V1 version anymore :pensive: bummer

I found a shop here selling it but they have 20 days delivery, so I’m guessing their stock is questionable.

I can call them on Monday and ask I’d they can get it and ship it to you?

Is there a possibility to add the start stop printer, choose file etc commands to the official integration. Thank you

1 Like

Pretty happy with my setup :smile:

2 Likes

Very nice! could you give us some info on your hardware and sensors?

There are definitely better ways to do it now when I look back at my setup but this happens when you start adding features as you build and use stuff you have lying around. I would also upload some pics but I just busted my mobile phone’s screen and waiting for replacement. I will try to upload some at the later date.

So I’m running 4 ESPhome boards. Three of them built in my enclosure and one separated.

Board 1 - Esphome flashed D1Mini driving two 140mm independent fans (for climate control) connected to D1mini via simple transistor board. Exhaust fan has carbon and hepa filter installed. Additionally board is driving spot light which is basically two 5v led usb/thumb lights in small enclosure so I can illuminate the area for the pi cam. I also connected two buttons with leds to Dmini for the control panel I have on the front of the enclosure.

Board 2 - Esphome flashed Arilux basic led driver connected to rgb led strip for the whole enclosure illumination. I used additional gpios for driving the hall sensor installed in the door for the enclosure to light up when door is opened. I also have button with led for the front panel.

Board 3 - Esphome flashed Sonoff basic to shut down the printer and octopi with the relay. It also has button with led for the front panel.

Board 4 - Its a separated device I made for my desk. Its a esp32 board esphome flashed which has sensirion sps30 air quality sensor connected to it.The board also has small oled screen to display sensors data. The board also tracks two BLE temp/humidity sensors in my two filament dry boxes. I use the device with rotary encoder to see and adjust home thermostat but that is not octoprint related.

As I had one extra deconz connect temp/humidity/pressure sensor I use it inside the enclosure for the enclosure climate control.

Did I mention I love ESPhome :slight_smile:

It all sounds a bit messy but really isn’t. If I started working on this now I would definitely use less boards but maybe for enclosure 2.0 I will. For now my setup works great.

nice! The REST call for shutting down octoprint solved one of my issues with my setup.
I have a homematic smart switch with power monitoring which I used to hard shut down the printer after the nozzle was cooled below 30°. I have added the REST API call to shut down the octoprint raspi and after 20 seconds I shut down the whole setup.
I tried to keep the interface clean and simple because I mainly use the infos on the phone, on the desktop I use octoprint directly. Don’t mind the background - I use animated background and this looks funky on some screens :slight_smile:

1 Like

Very Nice !! Do you want to share the code for this ?

Here you are :slight_smile:
I have tweaked it a bit again.
Btw.: the colors change depending on the state. I have a scheme there for all of my devices/sensors:
white - off
blue - on/operational/standby
green/yellow/red - working states depending on state (eg temperature)

cards:
  - cards:
      - entity: sensor.ender_3_pro_current_state
        name: Status
        aspect_ratio: 1/1
        show_state: true
        state:
          - value: Operational
            color: blue
          - value: Printing
            color: green
        type: 'custom:button-card'
      - type: button
        tap_action:
          action: toggle
        entity: switch.0001d3c99c8439
        name: 'ON'
        icon: 'mdi:power-on'
      - entity: script.3d_printer_shutdown
        hold_action:
          action: more-info
        icon: 'mdi:power-off'
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        type: button
        name: 'OFF'
      - entity: sensor.ender_3_pro_job_percentage
        max: 100
        min: 0
        name: Fortschritt
        type: gauge
    type: horizontal-stack
  - cards:
      - entity: sensor.ender_3_pro_actual_tool0_temp
        show_state: true
        name: Nozzle
        icon: 'mdi:printer-3d-nozzle-outline'
        state:
          - value: 0
            color: white
          - value: 190
            operator: <=
            color: blue
          - value: 250
            operator: '>='
            color: red
          - operator: default
            color: green
        type: 'custom:button-card'
      - entity: sensor.ender_3_pro_actual_bed_temp
        show_state: true
        name: Bed
        icon: 'mdi:radiator'
        state:
          - value: 0
            color: white
          - value: 50
            operator: <=
            color: blue
          - value: 75
            operator: '>='
            color: red
          - operator: default
            color: green
        type: 'custom:button-card'
      - entity: sensor.3d_printer_power
        show_state: true
        name: aktuell
        state:
          - value: 5
            operator: <=
            color: white
          - value: 20
            operator: <=
            color: green
          - operator: default
            color: yellow
        type: 'custom:button-card'
      - entity: sensor.3d_printer_energy_since_switch_restart
        show_state: true
        name: gesamt
        type: 'custom:button-card'
    type: horizontal-stack
  - aspect_ratio: 50%
    camera_image: camera.octoprint
    entity: camera.octoprint
    type: picture-entity
    show_state: false
    show_name: false
  - cards:
      - entity: sensor.ender_3_pro_time_elapsed_format
        name: Druckzeit bisher
        type: entity
        icon: 'mdi:clock-start'
      - entity: sensor.ender_3_pro_time_remaining_format
        name: Druckzeit verbleibend
        type: entity
        icon: 'mdi:clock-end'
    type: horizontal-stack
  - cards:
      - animate: true
        color_thresholds:
          - color: green
            value: 20
          - color: yellow
            value: 100
          - color: red
            value: 200
        entities:
          - entity: sensor.3d_printer_power
            name: Verbrauch
        font_size: 75
        hour24: true
        hours_to_show: 168
        labels: true
        labels_secondary: true
        line_color: blue
        line_width: 3
        lower_bound: 0
        name: Leistung letzte Woche
        icon: 'mdi:chart-line'
        points_per_hour: 2
        show:
          extrema: true
          labels: true
          points: hover
          state: false
          fill: true
        type: 'custom:mini-graph-card'
        upper_bound: 350
    type: horizontal-stack
type: vertical-stack

4 Likes

Thanks for the code !!

1 Like

Does this actually trigger on 3dprinter fumes like from PLA? I’ve played with adding a air quality sensor too, but those are quite expensive and I don’t want to waste money on something that doesn’t sense printer fumes. This could of course be used as a smoke detector if something goes really south and turn off power for the printer.

Sps30 only shows amount of particles in the air so its not the whole story. Ideally I would also need VOC sensor just cover for harmful gasses. Still particle sensor gives me idea what is going on.

I dont think that printing Pla occasionally cause much issue. My sensor goes so much higher when I solder for example. Still when I did not have enclosure plus filters I could easily smell pla print going on even from the other room. Now with enclosure and two filters I cannot smell a thing.

Btw sensors are not that expensive. I paid for my sps30 just under £30.