guillaume-rico / PrusaLinkPy

MIT License
2 stars 1 forks source link

Connection with multiple Prusa printers #6

Open KeemoKimo opened 1 month ago

KeemoKimo commented 1 month ago

Hello, I have been using this library and it has been awesome so far!

However, yesterday I set up 3 more of my prusa printers and tried to use the same code that I used for one :

import PrusaLinkPy
prusaTest = PrusaLinkPy.PrusaLinkPy("ip/1/","API_key1")
prusaTest2 = PrusaLinkPy.PrusaLinkPy("ip/2/","API_key2")
prusaTest3 = PrusaLinkPy.PrusaLinkPy("ip/3/","API_key3")

Notice how normally the IP would be just something like 192.111.22.333 , but when I set up multiple printers it changed to 191.111.22.333/1/ , /2/ ... and so forth. But, when I tried to use that IP link with PrusaLinkPy, it just gives me 404 error and did not work.

Is there any solution to this? Or I might be doing something wrong?

I am relatively new to PrusaLink API and these topics also, so I would apologize in advance if my question does not make too much sense, but Thank you !

guillaume-rico commented 1 month ago

I'm glad to see that this lib is being used by other people! I have a similar use case: I have 24 printers connected to the network I use. I have an IP address for each printer. For example : Printer 1: 192.168.0.11 Printer 2: 192.168.0.12 Printer 3: 192.168.0.13

When I use the lib, I'll use the following code: ` import PrusaLinkPy

prusaTest1 = PrusaLinkPy.PrusaLinkPy("192.168.0.11","API_key1")

prusaTest2 = PrusaLinkPy.PrusaLinkPy("192.168.0.12","API_key2")

prusaTest3 = PrusaLinkPy.PrusaLinkPy("192.168.0.13","API_key3")

`

Each printer has a specific IP address. There must be no /1/ or /2/ or /3/ . Only in the case of Port Address Translation is a single IP address used, but I'm pretty sure that's not your case.

KeemoKimo commented 1 month ago

Thanks alot for your reply! I really appreciate it.

I have another question though, how can you have different IP for different printers?

Because, currently all my printers are connected to one raspberry Pi , and it just gives all the printers the same IP address with the /1/ , /2/ , /3/ at the end.

guillaume-rico commented 1 month ago

All my printers are connected to a single network. A DHCP router is on the network and it automatically allocates an IP address to each machine. An example of a router: https://www.tp-link.com/us/home-networking/wifi-router/tl-wr841n/

KeemoKimo commented 1 month ago

Thanks for your reply, I am looking into one of those router.

However, my situation now is that I have a bunch of prusa machine plugged into one Raspberry Pi and that Pi is connected to a single network port, so I am assuming that is why I only get the same IP address.

If I buy the DHCP router, and plug my Pi into it, will it gives the printer each different IP address? Or the way you do it is different?