Multiple printers per server megathread

Separate USB cam for each printer question:

I'm using this guide (which seems to be the "master" guide for setting up multiple printers) for setting up my two printers and cameras on my Pi with OctoPi. I've had some questions I've had to ask here, but, overall, it's all working well now. But there's a change I'd like to make.

Currently I'm using a PiCam for one printer and a USB camera for the other printer. I've printed camera mounts and articulated arms so I can position the cameras wherever I want. However, I'm still dealing with a limited field of view and miss parts of what I'm printing. I found a good USB webcam that has a wider field of vision, but claims to not be anamorphic. (The images don't look anamorphic.) It's great for being able to see everything I want.

I've tried an anamorphic lens on a PiCam and it's almost a full 180° field - but it's anamorphic and the field is rather distorted. I find the USB cam I'm using on the other printer is perfect for my needs. The issue is that when I use udevadm and do an attribute walk on the wide view camera and on another USB camera I use, the output is identical. So both cams use the same chip and all their ID info, including serial numbers, are identical.

Is there any way, in that situation, to tell to USB cams apart with udevadm or other software tools? Or is there any kind of firmware in USB cams that can be updated or that can take an individualized ID strong or even an ID byte? I'm thinking the answer is probably no, but I'm asking just in case there is some way to tell them apart.

yes, udev rules can be setup for each individual camera. I would have recommended to you to do the octoprint_deploy script as it will handle the multiple instances and cameras.

I've been using udev rules for the cameras I have - and they're both different. But even if the output for 2 cameras are identical when using udevadm, can it still distinguish between the two?

I believe it can based on the USB port it's plugged into, instead of the serial number.

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.

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

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:


Full URL would be:


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?