Led Progressbar for 3d Printing

Installation and Autoconvertion

3D printing can be fun, but can also be very annoying if something bad happens. So I wanted to have an easy indicator if something goes wrong without having to check the print every few minutes

WLED to the rescue

My 3D - Printer is in a small room. I usually do not have to enter that room until I want to remove the print. So I decided to add an RGB-LED-Strip that shows how the print is running. I decided to use WLED using a cheap ESP8266MOD. Installing the WLED-Software is easy. It can even be done using a simple browser if you are on Windows or Mac: https://install.wled.me/

Home Assistant

After that I needed to write some automations. The WLED is detected automatically on Home Assistant, for my Creality 3d Printer I used the "Moonraker" Integration available via HACS: https://moonraker-home-assistant.readthedocs.io/en/stable/index.html

Error display

The printer reports its Print state through the "sensor.k2plus_b4f8_current_print_state" (yours can have a different prefix). The following values are possible:

standby, printing, paused, complete, cancelled, error

But errors are never reported as an "error" but always as "paused". There might be more critical ones that are reported as error but I never had those. So all we have to do is to react on the "paused" - state and set the WLED accordingly:

alias: 3DP Error
description: ""
triggers:
  - entity_id:
      - sensor.k2plus_b4f8_current_print_state
    trigger: state
    to: paused
conditions: []
actions:
  - target:
      entity_id: light.wled_2
    action: light.turn_on
    data:
      effect: Breathe
      rgb_color:
        - 204
        - 0
        - 0
mode: single

Again: Your Entities might have different names

Progress display

To be able to display the progress we need the progress-Entity and in addition make sure that the printer really is printing:

alias: 3DP Progress
description: >-
  Updates WLED2 fill level to match sensor.k2plus_b4f8_progress value with
  purple color
triggers:
  - entity_id: sensor.k2plus_b4f8_progress
    trigger: state
conditions:
  - condition: state
    entity_id: sensor.k2plus_b4f8_current_print_state
    state: printing
actions:
  - target:
      entity_id: light.wled_2
    data:
      rgb_color:
        - 128
        - 0
        - 128
      effect: Percent
    action: light.turn_on
  - target:
      entity_id: number.wled_intensitat_2
    data:
      value: >
        {% set progress_value = states('sensor.k2plus_b4f8_progress') | float(0)
        %} {% if progress_value > 100 %}
          100
        {% elif progress_value < 0 %}
          0
        {% else %}
          {{ progress_value | round(1) }}
        {% endif %}
    action: number.set_value

Display Countdown

Last but not least: Because the 3d printer consumes quite an amount of power even on standby I want to shutdown power automatically when he finished printing. Shutting down itself is quite simple:

alias: 3DP Strom automatisch aus
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.k2plus_b4f8_current_print_state
    to: complete
    for:
      hours: 0
      minutes: 15
      seconds: 0
conditions:
  - condition: numeric_state
    entity_id: sensor.k2plus_b4f8_hotend_fan
    below: 10
  - condition: numeric_state
    entity_id: sensor.k2plus_b4f8_extruder_temperature
    below: 50
actions:
  - type: turn_off
    device_id: 710995d98fe3640e134ae275e94dc491
    entity_id: 7cd829033182474ac8f91a7c11539dfa
    domain: switch
mode: single

I wait 15 minutes and just to be sure I make sure the temperature of the extruder has gone below 50 degrees

Finally show the countdown for that 15 minutes:

alias: 3DP CountDown for Shutdown
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.k2plus_b4f8_current_print_state
    to: complete
    for:
      hours: 0
      minutes: 0
      seconds: 10
conditions: []
actions:
  - target:
      entity_id: light.wled_2
    data:
      rgb_color:
        - 0
        - 255
        - 0
      effect: Percent
    action: light.turn_on
  - target:
      entity_id: number.wled_intensitat_2
    data:
      value: 100
    action: number.set_value
  - repeat:
      count: 60
      sequence:
        - delay:
            hours: 0
            minutes: 0
            seconds: 15
            milliseconds: 0
        - target:
            entity_id: number.wled_intensitat_2
          data:
            value: >
              {% set calculated_value = 100 - ((repeat.index + 1) * (100/60)) %}
              {% if calculated_value < 0 %}
                0
              {% else %}
                {{ calculated_value | round(1) }}
              {% endif %}
          action: number.set_value
mode: single

That's it. These are my automations for my 3D printer status