Notifications
Clear all

PrusaLink and Home Assistant  

Stránka 1 / 2
  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!

Napsal : 30/07/2022 12:07 pm
pomah86 se líbí
pomah86
(@pomah86)
Active 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.

Napsal : 09/08/2022 7:22 am
David Smith
(@david-smith)
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!

 

Napsal : 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! 

Napsal : 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!

 

 

Napsal : 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!

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

From the September update it is now an official addon.

Napsal : 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.

 

Napsal : 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 před 2 years by Andy L
Napsal : 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. 

 

Napsal : 12/09/2022 9:00 pm
luma
 luma
(@luma)
Member
RE: PrusaLink and Home Assistant

Anyone else having any problems with the HA integration not providing the temperatures?  I get everything else (status etc), but the heatbed and tool temps are never available:

Napsal : 19/11/2022 4:44 pm
DudeShift
(@dudeshift)
New Member
RE: PrusaLink and Home Assistant

Did you ever figure this out? Just flashed the release firmware and added the home assistant integration. Say that the heatbed and tool temp are disabled by the integration for me. All other entities work while printing.

Posted by: @luma

Anyone else having any problems with the HA integration not providing the temperatures?  I get everything else (status etc), but the heatbed and tool temps are never available:

 

Napsal : 02/12/2022 10:01 pm
DJ
 DJ
(@dj-3)
Active Member
RE:

This looks awesome. Whenever the printer is ready Home Assistant:
- Turns on the LED strip above the printer
- Takes a camera snapshot 
- Sends a notifiction to my cellphone with the camera snapshot and a "PRINTER READY" message
- Blinks one lamp in the living room RED/BLUE for 2 seconds

ONE QUESTION REMAINING:  I notifced that there does not seem to be a different STATE when the printer requests a color change. It remains "printing".
Is it possible to 'detect' the printer waiting for a color change?

This post was modified před 1 year by DJ
Napsal : 07/12/2022 9:47 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE:

Sorry I missed this reply, So I don't use the integration for my temps, I had too many problems and so I use only the integration for the preview as I can't get that from API Thing. I use the below in my sensors.yaml, I'm not sure its the most efficient but it certainly works for me:

########################
#       PrusaLink      #
########################
- platform: rest
  resource:  http://PRINTER_IP/api/printer 
  name: Prusa Mini Telemetry
  method: GET
  scan_interval: 3
  headers:
    Content-Type: application/json
    X-Api-Key: !secret prusalink_api_key
  value_template: "OK"
  json_attributes:
    - "telemetry"
    - "temperature"
    - "state"

- platform: rest
  resource:  http://PRINTER_IP/api/job 
  name: Prusa Mini Job Status
  method: GET
  scan_interval: 3
  headers:
    Content-Type: application/json
    X-Api-Key: !secret prusalink_api_key
  value_template: "{{ value_json.state }}"
  json_attributes:
    - "job"
    - "progress"
    - "state"

- 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_bed_temp_actual:
      friendly_name: "Prusa Mini Bed Temp - Current"
      value_template: "{{ state_attr('sensor.prusa_mini_telemetry', 'telemetry')['temp-bed']}} °C"
      icon_template: >
        {% if is_state('sensor.prusa_mini_telemetry', 'on') %}
            fapro:bed_temp
        # Define the icon for all other states (include OFF)
        {% else %}
          fapro:bed_temp
        {% endif %}

    prusamini_bed_temp_target:
      friendly_name: "Prusa Mini Bed Temp - Target"
      value_template: "{{ state_attr('sensor.prusa_mini_telemetry', 'temperature')['bed']['target']}} °C"
      icon_template: >
        {% if is_state('sensor.prusa_mini_telemetry', 'on') %}
            fapro:bed_temp
        # Define the icon for all other states (include OFF)
        {% else %}
          fapro:bed_temp
        {% endif %}

    prusamini_nozzle_temp_actual:
      friendly_name: "Prusa Mini Nozzle Temp - Current"
      value_template: "{{ state_attr('sensor.prusa_mini_telemetry', 'telemetry')['temp-nozzle']}} °C"
      icon_template: >
        {% if is_state('sensor.prusa_mini_telemetry', 'on') %}
            fapro:nozzle_temp
        # Define the icon for all other states (include OFF)
        {% else %}
          fapro:nozzle_temp
        {% endif %}

    prusamini_nozzle_temp_target:
      friendly_name: "Prusa Mini Nozzle Temp - Target"
      value_template: "{{ state_attr('sensor.prusa_mini_telemetry', 'temperature')['tool0']['target']}} °C"
      icon_template: >
        {% if is_state('sensor.prusa_mini_telemetry', 'on') %}
            fapro:nozzle_temp
        # Define the icon for all other states (include OFF)
        {% else %}
          fapro:nozzle_temp
        {% endif %}
Napsal : 07/12/2022 11:20 am
DJ se líbí
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

Just added a reply to this thread which may help you 🙂

Posted by: @dudeshift

Did you ever figure this out? Just flashed the release firmware and added the home assistant integration. Say that the heatbed and tool temp are disabled by the integration for me. All other entities work while printing.

Posted by: @luma

Anyone else having any problems with the HA integration not providing the temperatures?  I get everything else (status etc), but the heatbed and tool temps are never available:

 

 

Napsal : 07/12/2022 11:22 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

I haven't seen this state in the API stuff, so not sure it's available yet, Prusa Link is still Beta though so maybe it's coming? I could also be wrong 😀

Posted by: @dj-3

This looks awesome. Whenever the printer is ready Home Assistant:
- Turns on the LED strip above the printer
- Takes a camera snapshot 
- Sends a notifiction to my cellphone with the camera snapshot and a "PRINTER READY" message
- Blinks one lamp in the living room RED/BLUE for 2 seconds

ONE QUESTION REMAINING:  I notifced that there does not seem to be a different STATE when the printer requests a color change. It remains "printing".
Is it possible to 'detect' the printer waiting for a color change?

 

Napsal : 07/12/2022 11:23 am
Cadster
(@cadster)
New Member
RE: PrusaLink and Home Assistant

There is also an official PrusaLink intergration, if you want to do it the easy way.

Napsal : 13/12/2022 9:43 am
D.R.racer
(@d-r-racer)
Active Member
RE: PrusaLink and Home Assistant

Is it possible to change the API key in an existing Home Assistance integration instance? Or do I have to remove the instance and create a new one? Thank you.

Napsal : 13/12/2022 7:25 pm
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

 

Posted by: @cadster

There is also an official PrusaLink intergration, if you want to do it the easy way.

Whilst this is true and I do use it for some aspects, for the above issues I tend to use my own sensors, I find them more reliable. That being said, I expect the official integration to improve.

Napsal : 20/12/2022 8:53 am
RandumbPrints
(@randumbprints)
Active Member
Topic starter answered:
RE: PrusaLink and Home Assistant

 

Posted by: @d-r-racer

Is it possible to change the API key in an existing Home Assistance integration instance? Or do I have to remove the instance and create a new one? Thank you.

As far as I know, you have to remove the integration and re-add

Napsal : 20/12/2022 8:55 am
Stránka 1 / 2
Share: