Octoprint - support for multiple printers

Here is a picture of my docker run with a configuration that works with my two working Octoprint servers:-

ok, Iā€™m not great with github. Iā€™ve been downloading the repository from your link which seems to point to the multi-octoprint branch. Should I be doing something else?

As long as you have cloned the repo and changed to the multiple_octoprint branch you should be fine.

what should the structure be for my custom_components directory. Is there a python file I need to update in the deps folder or anything?

I havenā€™t set up my second octoprint instance, but once I get that done Iā€™m happy to test this for you.

Can I clone these changes into the custom_components or do i need to clone the full repo? Iā€™m running in docker, which makes things a little trickier.

looks like you can by doing it like this: https://developers.home-assistant.io/docs/en/creating_component_loading.html

i have two prints running right now, iā€™ll experiment with this when theyā€™re done since i can just grab your changes instead of the whole repo.

Thanks!

yes, you can. But itā€™s not working for me so Iā€™m asking to see what the structure should be so that I can see where I installed it wrong.

Works a treat as a custom component on 76.2. Thanks to all these involved.
Will this be included as standard in a future release of Home Assistant?

Now I hope we can achieve more features on the Octoprint component. Things like pause/resume, display layer or height, etcā€¦

For now, to get additional info into the HA, Iā€™ve used the rest sensor and the octoprint API. Once I figure out how to contribute to the component, Iā€™d be happy to merge in my changes.

I just wrote my own in AppDaemon.

so iā€™m running my instances of octoprint behind the built in haproxy in octopi, which each printer at host.domain.net/printername. When i try this with your component I get the following errorā€¦

2018-10-10 14:20:57 ERROR (MainThread) [custom_components.octoprint] Error setting up OctoPrint Prusa i3 MK3 API: Reply for http://host.domain.net/api/version was not OK: <html>

Which leads me to believe somewhere the actual path is getting chopped off, and itā€™s only looking at the host portion.

Mind sharing?

My PR for adding support for multiple octoprint printers has been merged and should be in the next version (after 0.80.0).

Here is a preview of the documentation so you can take a look at the configuration changes: Octoprint Component Documentation

1 Like

Canā€™t get this to work.
Using 0.80.3 version.

Getting expected a dictionary. got ordereddict
Any idea?

It hasnā€™t been released yet. Wait for 0.81.0.

now that itā€™s merged in and available, i canā€™t get it to workā€¦

my config looks like this: https://github.com/noisufnoc/home-assistant-config/blob/master/configuration.yaml#L115

I get the entities in HA, but none of them are accurate, temp/job percentage/etc all are zero.

I think I know why, you have a path inside your config key that only supports a host.

host: octoprint.noisufnoc.net/pmk3

The API client expects a hostname/IP only so the url it internally builds would be:

http://octoprint.noisufnoc.net/pmk3:80/api/

And obviously that is invalid.

The component doesnā€™t support custom paths, so a workaround would be, if possible, to hit directly the octoprint instances on their separate ports.

If not, I could add a ā€˜pathā€™ config option, this should be a very small fix.

For some reason, I was under the impression that octoprint didnā€™t support custom path. It might not be the case anymore or I was just confused.

thanks for the reply.

so, for running multiple instances of octoprint to control multiple printers with a single pi, the typical approach is to modify the provided haproxy and use seperate paths. Iā€™ve found that many things, your code included, arenā€™t expecting a path and donā€™t tend to handle it well. It might just be easier in the long run, for me, to update haproxy (or move to nginx) and use subdomains instead.

so either way, i guess. if you dont have many complaints about the edge case like mine, than i can just fix myself (which will actually fix a couple other broken octoprint integrations in my house)ā€¦or implement the path

I do agree that in your case, having octoprint instances on separate subdomains would be best.

Iā€™ll fix the component so that it supports custom paths now that I confirmed that it is supported by octoprint.