Notifications
Clear all

PrusaLink and Home Assistant  

  RSS
RandumbPrints
(@randumbprints)
Active Member
PrusaLink and Home Assistant

Hello everyone, Hopefully Im asking in the right place.

So I currently use Home Assistant and Octoprint and I can get my printer information on my Home Assistant dashboards, but with the WiFi module update and PrusaLink now working I'm wondering if it it possible to pull this information in rather than have another device powered up and to the printer.

I'm curious as I have to use an api key to log into the web interface but beyond the basics I'm not sure how I can pull that info into HA.

Any help would be greatly appreciated!

Posted : 30/07/2022 12:07 pm
pomah86 liked
pomah86
(@pomah86)
New Member
RE: PrusaLink and Home Assistant
  1.  
Posted by: @randumbprints

Hello everyone, Hopefully Im asking in the right place.

So I currently use Home Assistant and Octoprint and I can get my printer information on my Home Assistant dashboards, but with the WiFi module update and PrusaLink now working I'm wondering if it it possible to pull this information in rather than have another device powered up and to the printer.

I'm curious as I have to use an api key to log into the web interface but beyond the basics I'm not sure how I can pull that info into HA.

Any help would be greatly appreciated!

I would like to see an official integration of this as well, hopefully with the addition of webcam in the future.

Posted : 09/08/2022 7:22 am
David Smith
(@david-smith-2)
New Member
RE: PrusaLink and Home Assistant

I have it working with the Wifi beta Prusalink on my mini, using Rest sensor platform. 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 }}"

Posted by: @randumbprints

Hello everyone, Hopefully Im asking in the right place.

So I currently use Home Assistant and Octoprint and I can get my printer information on my Home Assistant dashboards, but with the WiFi module update and PrusaLink now working I'm wondering if it it possible to pull this information in rather than have another device powered up and to the printer.

I'm curious as I have to use an api key to log into the web interface but beyond the basics I'm not sure how I can pull that info into HA.

Any help would be greatly appreciated!

 

Posted : 10/08/2022 10:02 pm
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

Thank you so much! I’ll give this a go today! 

Posted : 11/08/2022 5:53 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

Thank you so much for this! I managed to get it so I can see the printer, but Im struggling with the syntax to pull out the state attributes for temperatures etc

{{ states ('sensor.prusa_mini_telemetry') }} - This gives me "Ok"

{{ states.sensor.prusa_mini_telemetry }} - This gives me the list of attributes

{{ state_attr('sensor.prusa_mini_telemetry', 'temp-bed') }} - This is the one Im struggling with, no matter what I change the name too all I seem to get back is "None"

Don't suppose you could shed any light on this?

Posted by: @david-smith-2

I have it working with the Wifi beta Prusalink on my mini, using Rest sensor platform. 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 }}"

Posted by: @randumbprints

Hello everyone, Hopefully Im asking in the right place.

So I currently use Home Assistant and Octoprint and I can get my printer information on my Home Assistant dashboards, but with the WiFi module update and PrusaLink now working I'm wondering if it it possible to pull this information in rather than have another device powered up and to the printer.

I'm curious as I have to use an api key to log into the web interface but beyond the basics I'm not sure how I can pull that info into HA.

Any help would be greatly appreciated!

 

 

Posted : 11/08/2022 11:15 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

I was being daft! You've given me all the information I needed, Just needed another coffee. Apologies and thank you!

Posted : 11/08/2022 11:36 am
pomah86
(@pomah86)
New Member
RE: PrusaLink and Home Assistant

From the September update it is now an official addon.

Posted : 08/09/2022 5:21 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

Yeah I saw this update last night, my custom sensors do what the add on does but also gets more information such as the material target temps and z-height.

only thing I’m using from the add on is the job preview

Posted by: @pomah86

From the September update it is now an official addon.

 

Posted : 08/09/2022 6:13 am
Andy L
(@andy-l-2)
New Member
RE:

I just recently started with Home Assistant and luckily the Prusa Link integration is now integrated.

Works pretty well for me and very easy to setup. 

This post was modified 2 weeks ago by Andy L
Posted : 12/09/2022 11:37 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

Nice! I use conditional cards to show the Preview and Webcam but this is my usual set up

Posted by: @andy-l-2

I just recently started with Home Assistant and luckily the Prusa Link integration is now integrated.

Works pretty well for me and very easy to setup. 

 

Posted : 12/09/2022 9:00 pm
Share: