Unreliable printer connection #61
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When running the bridge, the log consists of a constant list of failed connection attempts to the printer. What's strange is that for short periods the connection does seem to work, since I get information from the ams and turning the light on and off also works about 25% of the time. Is it possible that the frequency of connection attempts is overwhelming the printer?
Thanks for the log, @BasK — it narrows things down a lot. In ~13 seconds it shows 80 successful connects and 78 immediate disconnects:
The TLS handshake and login succeed every single time (
CONNACK rc=0); the connection then drops a few milliseconds later (EOF). There are no TLS errors, no timeouts, no rejected logins — so it is not the poll frequency overwhelming the printer. Each connection is set up cleanly and then torn down. There are two things that produce exactly this pattern:1. Two clients sharing the same MQTT session (most likely).
The printer's broker only allows one connection per client ID. If a second client connects with the same ID, the broker kicks the first one off (per the MQTT spec), both reconnect, and they keep knocking each other offline in a loop — which also explains the ~25% "works" windows (the brief moments between connect and kick). The second client is usually one of:
Please make sure only one bridge is running, and close the Anycubic app/slicer while testing.
2. A weak/unstable Wi-Fi link to the printer.
If the printer's Wi-Fi signal is poor, the connection can also drop repeatedly right after connecting, giving a similar
EOFloop. Could you check the printer's Wi-Fi signal strength, and ideally test with the printer close to the router (or on a wired connection if possible)? A quickping <printer-ip>from the bridge host for ~30s would also tell us if there's packet loss.My money is on #1 (a duplicate session), but #2 is worth ruling out at the same time. If stopping the duplicate client or improving the Wi-Fi makes the loop stop, that tells us which one it was. On our side we can also make the bridge's client ID unique so a collision can't happen in the first place — but I'd like to confirm the cause with you first.
#1 was spot on, I was running the Anycubic app at the same time as the bridge. Stopping the app immediately fixed all issues in the bridge. If there is anything you can do in the code to be able to run the anycubic app in parallel with the bridge then that would be great, otherwise I'll gladly switch to orcaslicer + the bridge fulltime. And I've said it before, but thanks again for both the speed and quality of your responses!
thx for the tip ;-)