The IP address of my printer changes periodically. If I run a print job, the ipOnConnect plugin will display the printer's IP on the LCD when the job ends. That's great!
That's intriguing, but it looks like it's sending the IP out over the I2C bus, which would at least require a hardware change.
I guess I need to understand better how Octoprint connects to the printer via USB. I suspect what's happening is that Octoprint is connected to the printer, but the IP is only sent when a new connection is established, or a print finishes. When the Pi's IP changes, Octoprint is still connected via USB, so it doesn't report the new IP.
I wonder if Octoprint can trigger an event detectable by the ipOnConnect plugin when the IP changes.
Install the portlister plugin and configure your connection's port and baudrate and check the option to autoconnect. Then when you power off the printer and power it back on OctoPrint will automatically connect to the printer and then my plugin will send the IP to the LCD. That's probably the missing piece for your issue.
Another thought would be to run a scheduled script on the RPi that checks the IP address and if it has changed, send an email, SMS, or a message with one of the other messaging applications.
@jneilliii Yeah, I set the port and baud rate. I'll try messing with the autoconnect delay.
@b-morgan That's an interesting idea.I could just write a little Python script that sends a UDP packet to a server every 15 minutes. I'm hesitant to write something odd that I'll have to remember the details of in a few months.
The RPi has a hostname associated with it (default is octopi) and in many larger networks, its name isn't octopi.local but octopi.<local dns domain>. Also you may not be the only OctoPrint user on your university network, so I'd change the hostname to something more unique to you. Then see if that hostname is resolvable.
I assume all the printers use DHCP to obtain their IP address(es). Normally the DHCP server communicates with the DNS server so that when an IP address changes, DNS is automagically updated.
When a DHCP client asks for a new lease, it asks for the same IP address as it had previously. Are you turning the RPi systems off for extended periods? I turn my 3D printer off when I'm not using it but the RPi is left on. Even 12 of them won't consume that much power so I'd just leave them running.
Yes, everything you describe is correct, except that the university occasionally reconfigures its network, which gives all 12 printers new IPs. Most of the printers are running close to 24 hours per day, at least when school is underway, so they don't get turned off much.
I set up our domain name so that I wouldn't have to rely on the university to add new printers and such. Generally, it's worked fine, but this week, they're switching things around to debug some network problem, so I thought it would be worth trying to sort this out.
One other thing I just thought of that could interfere with this is if your printer is backpowered from the USB connection of the pi. This would prevent the printer from disconnecting altogether possibly. From memory you select the port and baudrate check the two boxes in the connection pane and click Connect. Once that is done the portlister plugin in theory should work.
Backpowering is certainly a possibility, though the printer does give the appearance of rebooting when the printer power is cut. Still, the USB port could possibly remain up?
Yeah, if the USB is able to power the printer's main board then a connection would already be established when the power was turned on I think. Which means portlister is probably already seeing the connection established and doesn't try to initiate the connection.