Multiple printers per server megathread

I never knew it was possible to ID a USB device from the physical port with software, so I've learned something new from this (aside from if I can do this). Thank you!

I added this guide that explains how to use dockers (which are not mentioned in this megathread at all) to run multiple servers.

It also discusses how to identify usb devices consistently on linux.
Cheers,
Erez

I've searched but can't find anything useful for this issue.

I use Home Assistant and, after my last upgrade to HA, my Octoprint server showed up. It didn't before this, but now it's there, complete with webcam feed. However I see no way to add the 2nd instance on from my Pi running OctoPi.

Is there any known way to get Home Assistant to see both instances of OctoPrint on a Pi?

How to setup multiple printers? Β· Issue #132 Β· OctoPrint/OctoPrint-MQTT Β· GitHub might help you out.

I'm looking that over now. I don't have an MQTT integration on HA. Do you know if it's something they automatically include? Is it finding the one OctoPrint instance through MQTT already? Or is there some other way it might be discovered?

I'm the original poster for the GitHub thread above, looks like you're not using mqtt while connecting octoprint to HA (I highly recommend you should use mqtt - faster and more information), but if you're using the standard octoprint integration, go to your integrations add octoprint and give it the host of your 2nd instance, it should work.

I take it you mean the IP address? Or the IP address and any subdirectories, since I have two instances on one Pi.

One is at http://erebor/prusa and that's the one HA knows about. (It was the first instance I set up.) The 2nd instance is at http://erebor/e3p. So you're suggesting, if I understand it right, I add Octoprint as an integration and give it http://erebor/e3p as the address?

not sure how you got that as address. If you're using the same pi they would have same ip address with different ports for the octoprint instances, try entering ip with ports in octoprint integration? Example 192.168.1.50:8000

My LAN DNS provides names for all my devices. I can remember names, but not numbers. (Plus, as a Tolkien fan, I love typing something like "ssh pi@erebor.") I'm experimenting - using the host name, the full domain name - for this LAN, that's arda.ea - and IP address. They have port in a different field. I'm finding, in each case, it's telling me it can't retrieve the application API key. (I created a new key on that Octoprint instance for HA.)

I'd like to add MQTT, but I haven't used it in a good while and I'd have to read up on it to familiarize myself with it again. As it is, with just Octoprint, on the first instance, it seems to have everything I need for info.

I still have more combinations to try. I wish I could read the info on the other instance so I could specifically see what it used as host and port, for example.

A few notes:

  1. I needed to add the plugin Home Assistant Discovery and make sure I have it set so notifications will pop up. Once I did that, I got the notice from a pop-up and responded.

  2. Using just the normal Octoprint integration, after I responded in the OctoPrint pop-up, I got a notice on HA that the device was already configured. It looks like, if I want two instances on the same Pi to show up on HA, I'm going to have to go on and add MQTT and go through there.


I was about to give up for the evening and found one more thing in the docs, something I misunderstood the first time through. In /home/pi/.octoprint/config.yaml is the UUID, under upnpUuid. But most of the time when you set up the 2nd instance of OctoPrint, it goes in /home/pi/.octoprint2/config.yaml and most of the time, none of us change the UUID for the 2nd instance. So go online and find a UUID generator, generate a UUID and replace the one in that 2nd instance with the new UUID. I did this, rebooted the entire system, played a quick game of solitaire, then went back to Octoprint, made sure it was up, and went to HA. It had already discovered the 2nd instance on its own.

The one issue is that it sees the camera there, but is not getting a stream from it. That could be an issue with the ports specified in haproxy or something.

Ah okay I might look into naming my devices as well, as for mqtt there is a tutorial on YouTube how to setup octoprint mqtt on ha, the only thing he forgets to mention is that on your 2nd instance before you even setup discovery don't forget to change base topic on mqtt plugin in octoprint, I didn't do that and kept scratching my head, another point is that if you mess up anything you can go to ha mqtt integration and delete that particular device(octo instance) and start over, waiting to hear back from you 2 successful installs :slight_smile: after you finish that up go ahead and install threedy from hacs for some neat 3d printer cards for HA.

Do you have a webcam on both instances of OctoPrint? I did find that this is a known issue and just came up as a recent issue. From what I get out of that, the Octoprint integration in HA expects the webcam to be at port 5001. There's no way, at this point, with just the Octoprint integration, to tell it where to look in a 2nd instance for the 2nd webcam.

The mqtt integration didn't get the camera automatically, I didn't look into it because i'm mostly using it for automations only. what do you have defined here?

I have just:

/came3p/?action=stream

Full URL would be:

http://172.16.7.21/campe3p/?action=stream

or

http://172.16.7.21:5011/?action=stream

The default address or port would go to my instance with my Prusa or the webcam on the Prusa. I have 5000 and 5001 sent to the Prusa instance and Prusa webcam, respectively. 5010 and 5011 go to the 2nd instance, for an Ender 3 Pro. (I figured I'd make each instance off 10 more on port numbers, and add 1 to that for the webcam - I tend to try to keep things in a systematic pattern so I can keep track if I add more.)

It should be the one with the port number and it would go on the octoprint instances, first thing I'd do is open that url and see if the stream shows up before even trying to have it show up on ha

Yes, it does. Like you, that's the first thing I checked. I think the Octoprint integration just assumes the webcam is on port 5001. Take a look at this issue and see if that seems to be what they're saying.

PrusaSlicer and 2 printers:

I have 2 printers on my OctoPi setup and have been using PrusaSlicer and sending my gcode files directly from the slicer to the printer, through OctoPrint, with no problem at all. I've now finally reached the point of wanting to do the same with my other printer, an Ender 3 Pro. I've gone to the 2nd instance on the Pi, the one that controls the Ender, and tried to setup the connection from PrusaSlicer to OctoPrint. I created an API key just for this purpose and pasted it into the field in PrusaSlicer, but PS cannot connect to OctoPrint. I get this error:


Could not connect to OctoPrint: HTTP 403: {
"error": "Invalid API key"
}
Note: OctoPrint version at least 1.1.0 is required.

(I'm using OctoPrint 1.9.x.)

When I try it using the API key for the 1st instance of OctoPrint on the Pi, the one that controls a Prusa, I get a connection. I don't want to test it because I suspect it's connecting with the 1st instance of OctoPrint and not the 2nd one, which is the one matching this printer.

To make an API connection to the 2nd instance, do I need to add the port or the rest of the URL I use in Chrome to reach the 2nd instance? I can think of multiple possibilities of what I might need to do to connect to the API of that 2nd instance and don't want to just be taking shots in the dark.

So what do I use to get the 2nd instance API? A port, an extended URL? Something else?

Depends on how you added the second instance. In general if you put the same URL you use to connect to OctoPrint's interface in that setting for each instance individually as their own printer profile in PrusaSlicer that will allow you to have separate application keys per instance, etc.

I set up my printers to work with different URLs, like 192.168.1.12/prusa and 192.168.1.12/e3p. I also remember going through and using haproxy to assign those URLs to ports. Since 192.168.1.12 works for the Prusa (the default one), I tried 192.168.1.12/e3p for the Ender and it worked. (I'll probably update the URL for the Prusa to add /prusa - that way if I add a 3rd printer, and it's a Prusa, I'll be ready for it.)

Thank you!

1 Like

Don't forget to mark the solution.

There is no Solution box in the FAQ sub-sub-section