Prusa Mini 3D Printer Info

Hi Jiri,

great card, will you share the settings?

Here it is.

type: vertical-stack
cards:
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: sensor
            entity: sensor.prusa_mini_status
            theme: dark
            name: Status
          - type: sensor
            entity: sensor.prusa_mini_material
            theme: dark
            name: Material
          - type: sensor
            entity: sensor.prusa_mini_time_done
            theme: dark
            name: End time
  - type: vertical-stack
    cards:
      - type: sensor
        entity: sensor.prusa_mini_project_name
        name: Name
        theme: dark
  - type: gauge
    min: 0
    max: 100
    entity: sensor.prusa_mini_progress
    theme: dark
    severity:
      green: 95
      yellow: 50
      red: 0
    name: Progress
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: sensor
            entity: sensor.prusa_mini_temp_nozzle
            name: Nozzle temp.
            theme: th_sensor_temp
            graph: line
          - type: sensor
            entity: sensor.prusa_mini_temp_bed
            graph: line
            name: Bed temp.
            detail: 1
            theme: th_sensor_temp2
            hours_to_show: 2424
          - type: sensor
            name: Z-Axes
            theme: dark
            entity: sensor.prusa_mini_pos_z_mm
            graph: line
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: sensor
            entity: sensor.prusa_mini_print_dur
            name: Printing time
            theme: dark
          - type: sensor
            entity: sensor.prusa_mini_time_countdown
            theme: dark
            name: Countdown
            detail: 1

1 Like

thank you very much

will you update the custom repository to time time left / completing countdown and code from @GlennHA if its ok for him/her? so we can merge everything in the component?

i find it pretty useful and would be great to get constantly updated if prusa will add additional features to prusa connect.

1 Like

I have no issues, since everything is just a tweak of work others have done.

Last firmware update added time_zone (only during printing), which is not that useful but it is more data if you want it.
I did some experimenting with the filament sensor during printing and have some results.

Under all circumstances, printing or not, “material” will be “---” when there is no filament.
If you run out of filament during a print the material will be “---” but you will still have project_name, print_dur, and progress.

JSON available when NOT printing:
temp_nozzle
temp_bed
material
pos_z_mm
printing_speed
flow_factor

JSON available when printing:
temp_nozzle
temp_bed
material
pos_z_mm
printing_speed
flow_factor
progress
print_dur
time_est
time_zone
project_name

I am posting this now, just in case someone wants to beat me updating the REST API examples from above. I will work adding probably a binary sensor for out of filament or maybe say “no filament loaded” under material. I will add for status “Waiting on Filament” or something to that effect when the printer runs out of filament while printing (this is only applicable if you have the filament sensor).

I would like any input if anyone has seen any other circumstances on “IP/api/telemetry” that I, or other above have not noticed yet. If someone is brave or independently rich, you could try overheating the bed and the nozzle and see if there is a over temp alarm.

Also, someone will have to post after me here since I already have 2 post in a row and I found out that the forum will prevent you from posting too many times in a row without someone else posting.

Thanks all for sharing how you connected HA to your Pursa mini! With these suggestions I had me setup running in no time. Based on the suggestions above I have combined it to the following:

  - platform: rest
    name: "prusa-connect"
    resource: http://10.0.0.37/api/telemetry
    value_template: '{{ value_json.progress }}'
    unit_of_measurement: "%"
    scan_interval: 30
    json_attributes:
          - "temp_nozzle"
          - "temp_bed"
          - "material"
          - "pos_z_mm"
          - "printing_speed"
          - "flow_factor"
          - "progress"
          - "print_dur"
          - "time_est"
          - "time_zone"
          - "project_name"
  - platform: template
    sensors:
      prusa_connect_status:
         friendly_name: "Printer Status"
         value_template: >-
           {% if states.sensor.prusa_connect.attributes["time_est"] is defined %}
             Printing
           {% elif states('sensor.shelly_shsw_pm_xxxxxx_current_consumption') | float >= 50 %}
             Warming
           {% elif states('sensor.shelly_shsw_pm_xxxxxx_current_consumption') | float >= 35 %}
             Maintaining Temperature
           {% elif states('sensor.shelly_shsw_pm_xxxxxx_current_consumption') | float >= 4 %}
             Cooling
           {% elif states.sensor.prusa_connect.attributes["temp_nozzle"] >= 50 %}
             Cooling
           {% else %}
             Idle
           {% endif %}
         icon_template: mdi:printer-3d
         availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
      prusa_connect_time_countdown:
        friendly_name: "Estimated Completion Countdown"
        value_template: "{{ states('sensor.prusa_connect_time_est') | float | timestamp_custom('%H hr %M min', false)}}"
        icon_template: mdi:calendar-clock
      prusa_connect_time_done:
        friendly_name: "Estimated Completion Time"
        value_template: "{{ (as_timestamp(now()) + states('sensor.prusa_connect_time_est') | float) | timestamp_custom('%H:%M')}}"
        icon_template: mdi:calendar-clock
      prusa_connect_progress:
        friendly_name: "Print Progress"
        value_template: '{{ states.sensor.prusa_connect.attributes["progress"] }}'
        unit_of_measurement: "%"
        icon_template: mdi:printer-3d
      prusa_connect_temp_nozzle:
        friendly_name: "Nozzle Temperature"
        value_template: '{{ states.sensor.prusa_connect.attributes["temp_nozzle"] }}'
        unit_of_measurement: "°C"
        device_class: temperature
        icon_template: mdi:printer-3d-nozzle
      prusa_connect_temp_bed:
        friendly_name: "Heatbed"
        value_template: '{{ states.sensor.prusa_connect.attributes["temp_bed"] }}'
        unit_of_measurement: "°C"
        device_class: temperature
      prusa_connect_material:
        friendly_name: "Material"
        value_template: '{{ states.sensor.prusa_connect.attributes["material"] }}'
        icon_template: mdi:wall
      prusa_connect_pos_z_mm:
        friendly_name: "Z-Height"
        value_template: '{{ states.sensor.prusa_connect.attributes["pos_z_mm"] }}'
        unit_of_measurement: "mm"
        icon_template: mdi:tape-measure
      prusa_connect_printing_speed:
        friendly_name: "Printing Speed"
        value_template: '{{ states.sensor.prusa_connect.attributes["printing_speed"] }}'
        icon_template: mdi:speedometer
        unit_of_measurement: "%"
      prusa_connect_flow_factor:
        friendly_name: "Printing Flow"
        value_template: '{{ states.sensor.prusa_connect.attributes["flow_factor"] }}'
        icon_template: mdi:water
      prusa_connect_print_dur:
        friendly_name: "Printing Time"
        value_template: '{{ states.sensor.prusa_connect.attributes["print_dur"] }}'
        icon_template: mdi:timer-sand
      prusa_connect_time_est:
        friendly_name: "Estimated End"
        value_template: '{{ states.sensor.prusa_connect.attributes["time_est"] }}'
        icon_template: mdi:timelapse
      prusa_connect_project_name:
        friendly_name: "Project"
        value_template: '{{ states.sensor.prusa_connect.attributes["project_name"] }}'
        icon_template: mdi:file

And with the Lovelace card by jhoralek:

type: vertical-stack
cards:
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: sensor
            entity: sensor.prusa_connect_status
            theme: dark
            name: Status
          - type: sensor
            entity: sensor.prusa_connect_material
            theme: dark
            name: Material
          - type: sensor
            entity: sensor.prusa_connect_time_done
            theme: dark
            name: End time
  - type: vertical-stack
    cards:
      - type: sensor
        entity: sensor.prusa_connect_project_name
        name: Name
        theme: dark
  - type: gauge
    min: 0
    max: 100
    entity: sensor.prusa_connect_progress
    theme: dark
    severity:
      green: 95
      yellow: 50
      red: 0
    name: Progress
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: sensor
            entity: sensor.prusa_connect_temp_nozzle
            name: Nozzle temp.
            theme: th_sensor_temp
            graph: line
          - type: sensor
            entity: sensor.prusa_connect_temp_bed
            graph: line
            name: Bed temp.
            detail: 1
            theme: th_sensor_temp2
            hours_to_show: 2424
          - type: sensor
            name: Z-Axes
            theme: dark
            entity: sensor.prusa_connect_pos_z_mm
            graph: line
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: sensor
            entity: sensor.prusa_connect_print_dur
            name: Printing time
            theme: dark
          - type: sensor
            entity: sensor.prusa_connect_time_countdown
            theme: dark
            name: Countdown
            detail: 1

If you would like have the same time format like print_dur for print_countdown (days, hours, minutes, eg.: 1d 3h 44m).

    prusa_connect_time_countdown:
      friendly_name: "Restzeit"
      value_template: >-
        {% set etime = states.sensor.prusa_connect.attributes["time_est"] | int %}
        {% set seconds = etime % 60 %}
        {% set minutes = ((etime % 3600) / 60) | int %}
        {% set hours = ((etime % 86400) / 3600) | int %}
        {% set days = (etime / 86400) | int %}
        {% if days > 0 %}{{ days }}d {% endif %}{% if hours > 0 %}{{ hours }}h {% endif %}{% if minutes > 0 %}{{ minutes }}m{% endif %}
      icon_template: mdi:timer-sand
1 Like

As I do not need a Raspberry Pi anymore with this sensors, I searched for a solution for a camera and a light. If your requirements are not too big, then an ESP-32-CAM is the right solution. Camera with integrated LED light. It runs ESPHome of course :slight_smile:.

The mount is based on https://www.prusaprinters.org/de/prints/45962-prusa-mini-mini-raspberry-pi-camera-module-v21-8mp and modified in Fusion 360. And you have to desolder the pins from the ESP pcb.

App:

Interval notifications (every xx minutes during printing):

Finished notification:

Hint: In automations to capture a image for notifications you need a wait for round about 8 seconds (white balance) after turning on the LED.

Hint2: For the finished notification you need to adjust your end gcode in your slicer.

3 Likes

I like your method for display with the “if” statement. I like how compact mine is but I don’t like the leading 0’s.

Well the Prusa sensors still aren’t my biggest set of sensors so I might as well add to it.
I still need to modify the status for out of filament, easy, but I need time at home to do it. Life sometimes gets in the way.

On a side note:
You should print a back cover for you LCD panel.

I was thinking of going the OctoPrint route just to have a camera, but this solution is better in my case I believe.

Could you add your notification code here? I have never added a picture to a notification and plagiarizing yours is a quicker start then starting from scratch.

Will this do stills only, or also video?
I assume you have the ESP camera imported as a camera sensor into HA or does the ESP integration catch this?

There are some ways to figure out print complete without changing the G-code; if you do this manually I would look for other methods such as nozzle temp lowing and unavailability of some sensors to determine print complete. I have a Shelly PM1 in-line with my printer so I have other methods myself; the shelly monitors the power usage and allows me to turn the printer on/off without having to reach for the switch on it. I also relocated the USB port closer to the front for convenience.

The camera location looks perfect and I can’t see it ever getting in the way on the side of the stepper.

Some changes that incorporate Out of Filament and change the countdown time without leading zeros @haip. During the 2021.4 update the way availability templates work has changed, in my opinion for the better @allmyhinges. I, for now, decided not to go with the binary_sensor for out of filament, I just change printer status. I added time_zone to the main prusa_connect sensor.

I also changed the Estimated Completion Time to only display if there is a print in progress, previously upon print completion the time would just be the current time. I changed it to not display a time if there is no print or if the print was complete based off the seconds remaining received from the Prusa Mini.

I have the feeling there was something else, but it escapes me at this time.

If firmware updates expose any more data, I will update and post.

Also, just to clarify, you will need to modify the Printer_Status section if you do not have some type of energy monitor that feeds into HA.

### Prusa Mini 3d Printer
- platform: rest
  name: "prusa_connect"
  resource: http://xxx.xxx.xxx.xxx/api/telemetry
  value_template: '{{ value_json.progress }}'
  unit_of_measurement: "%"
  scan_interval: 30
  json_attributes:
    - "temp_nozzle"
    - "temp_bed"
    - "material"
    - "pos_z_mm"
    - "printing_speed"
    - "flow_factor"
    - "progress"
    - "print_dur"
    - "time_est"
    - "time_zone"
    - "project_name"

### Prusa Mini 3D Printer
- platform: template
  sensors:
    prusa_connect_progress:
      friendly_name: "Print Progress"
      value_template: '{{ states.sensor.prusa_connect.attributes["progress"] }}'
      unit_of_measurement: "%"
      icon_template: mdi:printer-3d
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_temp_nozzle:
      friendly_name: "Nozzle Temperature"
      value_template: '{{ states.sensor.prusa_connect.attributes["temp_nozzle"] }}'
      unit_of_measurement: "C"
      device_class: temperature
      icon_template: mdi:printer-3d-nozzle
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_temp_bed:
      friendly_name: "Heatbed Temperature"
      value_template: '{{ states.sensor.prusa_connect.attributes["temp_bed"] }}'
      unit_of_measurement: "C"
      device_class: temperature
      icon_template: mdi:bed-empty
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_material:
      friendly_name: "Material"
      value_template: '{{ states.sensor.prusa_connect.attributes["material"] }}'
      icon_template: mdi:wall
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_pos_z_mm:
      friendly_name: "Z-Height"
      value_template: '{{ states.sensor.prusa_connect.attributes["pos_z_mm"] }}'
      unit_of_measurement: "mm"
      icon_template: mdi:axis-z-arrow
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_printing_speed:
      friendly_name: "Printing Speed"
      value_template: '{{ states.sensor.prusa_connect.attributes["printing_speed"] }}'
      icon_template: mdi:speedometer
      unit_of_measurement: "%"
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_flow_factor:
      friendly_name: "Printing Flow"
      value_template: '{{ states.sensor.prusa_connect.attributes["flow_factor"] }}'
      icon_template: mdi:water
      unit_of_measurement: "%"
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_print_dur:
      friendly_name: "Printing Time"
      value_template: '{{ states.sensor.prusa_connect.attributes["print_dur"] }}'
      icon_template: mdi:timelapse
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_time_est:
      friendly_name: "Estimated Time Left"
      value_template: '{{ states.sensor.prusa_connect.attributes["time_est"] }}'
      icon_template: mdi:timer-sand
      unit_of_measurement: "Sec"
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_project_name:
      friendly_name: "Project"
      value_template: '{{ states.sensor.prusa_connect.attributes["project_name"] }}'
      icon_template: mdi:file
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_time_done:
      friendly_name: "Estimated Completion Time"
      #value_template: "{{ (as_timestamp(now()) + states('sensor.prusa_connect_time_est') | float) | timestamp_custom('%H:%M')}}"
      value_template: >-
        {% if states.sensor.prusa_connect.attributes["time_est"] is defined %}
          {{ (as_timestamp(now()) + states('sensor.prusa_connect_time_est') | float) | timestamp_custom('%H:%M')}}
        {% else %}
          {# Intentionally Blank #}
        {% endif %}
      icon_template: mdi:clock
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_time_countdown:
      friendly_name: "Estimated Completion Countdown"
      #value_template: "{{ states('sensor.prusa_connect_time_est') | float | timestamp_custom('%H hr %M min', false)}}"
      value_template: >-
        {% set etime = states.sensor.prusa_connect.attributes["time_est"] | int %}
        {% set seconds = etime % 60 %}
        {% set minutes = ((etime % 3600) / 60) | int %}
        {% set hours = ((etime % 86400) / 3600) | int %}
        {% set days = (etime / 86400) | int %}
        {% if days > 0 %}{{ days }}d {% endif %}{% if hours > 0 %}{{ hours }}h {% endif %}{% if minutes > 0 %}{{ minutes }}m{% endif %}
      icon_template: mdi:timer-sand
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_status:
      friendly_name: "Printer Status"
      value_template: >-
        {% if states.sensor.prusa_connect.attributes["material"] == "---" %}
          Out of Filament
        {% elif states.sensor.prusa_connect.attributes["time_est"] is defined %}
          Printing
        {% elif states('sensor.shelly_shsw_pm_XXXXXX_current_consumption') | float >= 60 %}
          Preheating
        {% elif states('sensor.shelly_shsw_pm_XXXXXX_current_consumption') | float >= 35 %}
          Preheated
        {% elif states('sensor.shelly_shsw_pm_XXXXXX_current_consumption') | float >= 4 %}
          Cooling
        {% elif states.sensor.prusa_connect.attributes["temp_nozzle"] >= 50 %}
          Cooling
        {% else %}
          Idle
        {% endif %}
      icon_template: mdi:printer-3d
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'

1 Like

Being a newbie to the world of 3d printing after my Prusa Mini arrived last week, ive obvioulsy done things in the exact order you would expect.

  1. Integrate it to HA
  2. Print the test Nut and Bolt.

Now im looking at your camera and as I have some ESP32 Cams around I would like to add this to my printer. Would you have the modified stl files to fit these cameras that you could share please? I havent yet delved into Fusion 360.

Thank you

2 Likes

Just an update on the camera for anyone looking to attach a esp32 cam. I ended up using a Prusa Mini mount from Prusa MINI mount (Gopro) by Quajeraz - Thingiverse
As I am not using a GoPro, I used this case which covers the esp32 cam too ESP32-CAM Case with GoPro Mount & MB support by peddamat - Thingiverse

Final result is a pretty good camera during printing as the bracket sits on the plate so what is printing remains in focus.

Here is a photo from the camera whilst the printer is working.

2 Likes

I updated @GlennHA’s latest configuration to enable preheating/preheated/cooling status without an external power monitor. I made a derivative sensor for the nozzle temp and set thresholds for heating, cooling and preheated. The thresholds might need a bit of tweaking, but they seem to be working for now.

EDITED: Fixed case where status would get stuck on ‘Preheated’.

  ### Prusa Mini 3d Printer
  - platform: rest
    name: "prusa_connect"
    resource: http://IPADDRESS/api/telemetry
    value_template: '{{ value_json.progress }}'
    unit_of_measurement: "%"
    scan_interval: 30
    json_attributes:
      - "temp_nozzle"
      - "temp_bed"
      - "material"
      - "pos_z_mm"
      - "printing_speed"
      - "flow_factor"
      - "progress"
      - "print_dur"
      - "time_est"
      - "time_zone"
      - "project_name"
  
    - platform: derivative
      source: sensor.prusa_connect_temp_nozzle
      name: Prusa Connect Temp Nozzle Slope
      unit_time: min
      time_window: "00:01:00"
      round: 2
     
    - platform: template
      sensors:
        prusa_connect_progress:
          friendly_name: "Print Progress"
          value_template: '{{ states.sensor.prusa_connect.attributes["progress"] }}'
          unit_of_measurement: "%"
          icon_template: mdi:printer-3d
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_temp_nozzle:
          friendly_name: "Nozzle Temperature"
          value_template: '{{ states.sensor.prusa_connect.attributes["temp_nozzle"] }}'
          unit_of_measurement: "C"
          device_class: temperature
          icon_template: mdi:printer-3d-nozzle
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_temp_bed:
          friendly_name: "Heatbed Temperature"
          value_template: '{{ states.sensor.prusa_connect.attributes["temp_bed"] }}'
          unit_of_measurement: "C"
          device_class: temperature
          icon_template: mdi:bed-empty
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_material:
          friendly_name: "Material"
          value_template: '{{ states.sensor.prusa_connect.attributes["material"] }}'
          icon_template: mdi:wall
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_pos_z_mm:
          friendly_name: "Z-Height"
          value_template: '{{ states.sensor.prusa_connect.attributes["pos_z_mm"] }}'
          unit_of_measurement: "mm"
          icon_template: mdi:axis-z-arrow
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_printing_speed:
          friendly_name: "Printing Speed"
          value_template: '{{ states.sensor.prusa_connect.attributes["printing_speed"] }}'
          icon_template: mdi:speedometer
          unit_of_measurement: "%"
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_flow_factor:
          friendly_name: "Printing Flow"
          value_template: '{{ states.sensor.prusa_connect.attributes["flow_factor"] }}'
          icon_template: mdi:water
          unit_of_measurement: "%"
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_print_dur:
          friendly_name: "Printing Time"
          value_template: '{{ states.sensor.prusa_connect.attributes["print_dur"] }}'
          icon_template: mdi:timelapse
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_time_est:
          friendly_name: "Estimated Time Left"
          value_template: '{{ states.sensor.prusa_connect.attributes["time_est"] }}'
          icon_template: mdi:timer-sand
          unit_of_measurement: "Sec"
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_project_name:
          friendly_name: "Project"
          value_template: '{{ states.sensor.prusa_connect.attributes["project_name"] }}'
          icon_template: mdi:file
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_time_done:
          friendly_name: "Estimated Completion Time"
          value_template: >-
            {% if states.sensor.prusa_connect.attributes["time_est"] is defined %}
              {{ (as_timestamp(now()) + states('sensor.prusa_connect_time_est') | float) | timestamp_custom('%H:%M')}}
            {% else %}
              {# Intentionally Blank #}
            {% endif %}
          icon_template: mdi:clock
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_time_countdown:
          friendly_name: "Estimated Completion Countdown"
          value_template: >-
            {% set etime = states.sensor.prusa_connect.attributes["time_est"] | int %}
            {% set seconds = etime % 60 %}
            {% set minutes = ((etime % 3600) / 60) | int %}
            {% set hours = ((etime % 86400) / 3600) | int %}
            {% set days = (etime / 86400) | int %}
            {% if days > 0 %}{{ days }}d {% endif %}{% if hours > 0 %}{{ hours }}h {% endif %}{% if minutes > 0 %}{{ minutes }}m{% endif %}
          icon_template: mdi:timer-sand
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
        prusa_connect_status:
          friendly_name: "Printer Status"
          value_template: >-
            {% if states.sensor.prusa_connect.attributes["material"] == "---" %}
              Out of Filament
            {% elif states.sensor.prusa_connect.attributes["time_est"] is defined %}
              Printing
            {% elif states('sensor.prusa_connect_temp_nozzle_slope') | float >= 10 %}
              Preheating
            {% elif -10 <= states('sensor.prusa_connect_temp_nozzle_slope') | float <= 10 and states.sensor.prusa_connect.attributes["temp_nozzle"] >= 50 %}
              Preheated
            {% elif states('sensor.prusa_connect_temp_nozzle_slope') | float < -10 %}
              Cooling
            {% else %}
              Idle
            {% endif %}
          icon_template: mdi:printer-3d
          availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
1 Like

This is way more useful to more people than my use of a power monitor.
Good Job and Thanks.

I will duplicate the prusa_connect_status sensor and then observe if there are any differences.

Edit
I think I figured out your order but the conditions for Preheated are met when it is Printing (Therefore will rarely if ever show Printing as a state). For simplicity you can move Printing above (the reason I did it). If you move Printing between Preheating and Preheated then that should cover everything. With yours I like that it will state Preheating during a print until it is actually ready.
I had Preheated in as a status to cover the manual selection of preheating on the printer without starting a print.

Ah, good point. I had just switched that around because I noticed that the prusa_connect_status went directly from ‘idle’ to ‘printing’.

I’ll poke around and figure out why that might be happening.

I will swap those status statements around in my above comment for now.

I wrote that with just manual heat-up in mind, not the heat-up during a print. As said, I think I like your preheating in preparation (automatically) for a print job.
I really like the Nozzle Heat-up/Cooldown Rate (Nozzle Slope) and will probably add one for the bed too.

Edit
I added the Bed Slope and changed the round to 0 to make it look nicer for the way I display it.

- platform: derivative
  source: sensor.prusa_connect_temp_nozzle
  name: Prusa Connect Temp Nozzle Slope
  unit_time: min
  time_window: "00:01:00"
  round: 0
- platform: derivative
  source: sensor.prusa_connect_temp_bed
  name: Prusa Connect Temp Bed Slope
  unit_time: min
  time_window: "00:01:00"
  round: 0

I have them both in for testing with and without an energy monitor. I moved my Printing to below Preheating also, since I like the result

    prusa_connect_status:
      # For use with energy monitor
      friendly_name: "Printer Status"
      value_template: >-
        {% if states.sensor.prusa_connect.attributes["material"] == "---" %}
          Out of Filament
        {% elif states('sensor.shelly_shsw_pm_xxxxx_current_consumption') | float >= 60 %}
          Preheating
        {% elif states.sensor.prusa_connect.attributes["time_est"] is defined %}
          Printing
        {% elif states('sensor.shelly_shsw_pm_xxxxx_current_consumption') | float >= 35 %}
          Preheated
        {% elif states('sensor.shelly_shsw_pm_xxxxx_current_consumption') | float >= 4 %}
          Cooling
        {% elif states.sensor.prusa_connect.attributes["temp_nozzle"] >= 50 %}
          Cooling
        {% else %}
          Idle
        {% endif %}
      icon_template: mdi:printer-3d
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'
    prusa_connect_status_test:
      # For use with no energy monitor
      friendly_name: "Printer Status Test"
      value_template: >-
        {% if states.sensor.prusa_connect.attributes["material"] == "---" %}
          Out of Filament
        {% elif states('sensor.prusa_connect_temp_nozzle_slope') | float >= 10 %}
          Preheating
        {% elif states.sensor.prusa_connect.attributes["time_est"] is defined %}
          Printing
        {% elif -10 <= states('sensor.prusa_connect_temp_nozzle_slope') | float <= 10 and states.sensor.prusa_connect.attributes["temp_nozzle"] >= 50 %}
          Preheated
        {% elif states('sensor.prusa_connect_temp_nozzle_slope') | float < -10 %}
          Cooling
        {% else %}
          Idle
        {% endif %}
      icon_template: mdi:printer-3d
      availability_template: '{{ not is_state("sensor.prusa_connect", "unavailable") }}'

:+1: That sounds great. I had initially added a slope sensor for bed temp, but figured I could do what I wanted without adding more work for myself.

It doesn’t seem that the derivative sensor can use the availability sensor, so now I have two non-useful (in this instance) items displayed when I turn off my printer. I auto hide ‘unavailable’ items. I think I have a work around, but will have to work on it later.