Prusa filament change notice

When Prusa 3D printer is printing and filament change is needed (or out of filament, too) nothing usable is reported in HA to be useful for trigger a warning.
One thing i noticed is that Z height is altered for appr.20mm (when it goes to filament change place), so i guess this would be useful for triggering automation to send a message to phone.
Is it possible to make a trigger for automation that it will trigger when Z height (sensor.prusamk4_z_height) is quickly changed for, say, more than 10mm? Like “if z height changes for more than 10mm in a period of 10 seconds then start automation” ?

z height would be one option, my understanding is that the trend integration could be used to trigger an automation based on a sudden change in the sensor value. Trend - Home Assistant

However I just noticed that the material sensor (sensor.prusalink_material) changes from whatever you’re printing from to “—” when a filament change starts.

This is what my automation looks like

alias: MK4 waiting for filament change notification
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.prusalink_material
    to: "---"
condition:
  - condition: state
    entity_id: sensor.prusalink
    state: printing
action:
  - device_id: ...
    domain: mobile_app
    type: notify
    message: MK4 Waiting for filament change
mode: single

I added the state: printing condition so it doesn’t send notifications for manual filament changes.

1 Like

Yes, i used to use “—” in material for this, too, but now, at least for MK4 it became obsolete, since new version of prusalink integration outputs “attention” in sensor.prusamk4 when filament needs to be changed. I can’t tell whether HA integration made this possible or newer FW in printer, but it’s here, along with some other usefull states (as “error”, for example).