Fixing Octoprint Integration in Home Assistant

So, Home Assistant has an integration for Octoprint. Seems like it would be really solid - a great thing!

Well, it is, unless you already have two printers set up in Home Assistant. I considered tearing it all out and rebuilding it. Delete it, and see what it comes back as. That probably would have been more sane. If you go this route, skip to Octoprint side fixes.

Identify what needs to get changed

The first step was that none of my sensors were correct. Fortunately, my input booleans (buttons for turning things on and off, retracting - those all go through MQTT topics in Node Red and were untouched.)

Octoprint side fixes

First, I went to two Octoprints and their Home Assistant Discovery plug-ins and changed the device name to be unique. (The names of the two printers showed up as "Octoprint", resulting in "Octoprint****_2" for some of the entities.)

Next, you do NOT need to change anything in MQTT. These are untouched.

Back in Home Assistant

In the configuration.yaml file, I was able to comment out all of the octoprint material, except for the temperature conversion templates. HA does not appreciate C or <degree-symbol>C to convert from Fahrenheit. (Once I'm sure I don't need it, I'll also kill their entries in the secrets.yaml file.) You'll also need to update the "what sensor am I converting from" for each of those templates.

Next, you'll need to fix the naming convention for each device and each entity sensor under that device. When I reloaded things, it seemed like there were 10 entities for each printer - low. Oh well - that's what all of the previous MQTT work was for, right?

Starting with Configuration > Integrations (Octoprint >  select one of the IP addresses > click on the entities. 6 of 10 came in just fine, but the tool/bed temperature-related ones needed to be renamed from the "_2".

Dashboard fixes

Any of those MQTT input boolean buttons should still be fine. My state-based Z-home vs. Cancel Job no longer worked, but the commands were still there. Mainly, it's just fixing the sensors that were renamed.

To fix the state-based buttons, I had to open up the 4th row in the code editor. The conditional sensors needed to be fixed, but the input booleans and text were fine.

Overall

It took about 30 minutes to fix it all. Destroying it and rebuilding might still be a better option - I only had 10 sensors show up.



Comments

Popular posts from this blog

Home Assistant Controlling Octoprint through MQTT - Chapter 1

Setting up MQTT on HA and Octoprint

Home Assistant Controlling Octoprint through MQTT - Chapter 2