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!
RE: 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!
I would like to see an official integration of this as well, hopefully with the addition of webcam in the future.
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 }}"
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!
RE: PrusaLink and Home Assistant
Thank you so much! I’ll give this a go today!
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?
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 }}"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!
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!
RE: PrusaLink and Home Assistant
From the September update it is now an official addon.
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
From the September update it is now an official addon.
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.
RE: PrusaLink and Home Assistant
Nice! I use conditional cards to show the Preview and Webcam but this is my usual set up
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.
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:
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.
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:
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?
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 %}
RE: PrusaLink and Home Assistant
Just added a reply to this thread which may help you 🙂
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.
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:
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 😀
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 secondsONE 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?
RE: PrusaLink and Home Assistant
There is also an official PrusaLink intergration, if you want to do it the easy way.
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.
RE: PrusaLink and Home Assistant
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.
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.
As far as I know, you have to remove the integration and re-add