Prusa Link

Hello everyone, hopefully I’m in the right place.

I’m using PrusaLink on my Prusa Mini+ printer and I was hoping that because it was running locally on my network it would be integratable (that’s not a word but feels like it should be) with HA.

I’ve seen similar previous versions running on a rest sensor, but because PrusaLink requires an API key I’m not sure how I would integrate this.

I am very much a n00b at this but willing to put in the work to get it working, any help would be appreciated though

Perhaps do a feature request?!
From what i see the wifi link to the Prusa mini is still beta.
More info about Prusa Link can be found here.

1 Like

I have it working with the Wifi beta Prusalink on my mini. The API key just needs to be passed in the headers. Rest sensor for the printer telemetry looks so:

- platform: rest
  resource: http://MINI_IP_ADDRESS/api/printer
  name: Prusa Mini Telemetry
  method: GET
  scan_interval: 3
  headers:
    Content-Type: application/json
    X-Api-Key: !secret prusalink_api_key <-- ENTER YOUR API KEY HERE, BETTER USE SECRET FILE
  value_template: "OK"
  json_attributes:
          - "telemetry"
          - "temperature"
          - "state"

Rest sensor for the job telemetry looks so:

- platform: rest
  resource: http://MINI_IP_ADDRESS/api/job
  name: Prusa Mini Job Status
  method: GET
  scan_interval: 3
  headers:
    Content-Type: application/json
    X-Api-Key: !secret prusalink_api_key <-- ENTER YOUR API KEY HERE, BETTER USE SECRET FILE
  value_template: "{{ value_json.state }}"
  json_attributes:
          - "job"
          - "progress"
          - "state"

Endpoints will return json values that you can process using template sensors. Example:

- platform: template
  sensors:
    prusamini_state:
      friendly_name: "Prusa Mini State"
      value_template: "{{ state_attr('sensor.prusa_mini_telemetry', 'state')['text'] if is_state('sensor.prusa_mini_telemetry', 'OK') else None }}"
    prusamini_time_remaining:
      friendly_name: "Prusa Mini Job Print Time Remaining"
      value_template: "{{ state_attr('sensor.prusa_mini_job_status', 'progress')['printTimeLeft'] | timestamp_custom('%H:%M:%S', 0) if is_state('sensor.prusa_mini_job_status', 'Printing') else 0 }}"
2 Likes

Works great, thanks!