Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Docs: mosquitto proxy for p series #58

Open
disconn3ct opened this issue Oct 29, 2024 · 5 comments
Open

[FR]: Docs: mosquitto proxy for p series #58

disconn3ct opened this issue Oct 29, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@disconn3ct
Copy link

This could probably be a wiki page or a contrib/ entry.
Is your feature request related to a problem? Please describe.

The MQTT broker on the P series is .. limited. This plugin uses up 3 connections, according to ss -tp. Somewhere I saw it documented that it can only accept 5 connections in total, and certainly everyone in LAN mode has had issues with too many simultaneous connections.

Describe the solution you'd like

Mosquitto can connect to other brokers and proxy messages back and forth, using only one connection. This plugin already works usefully well that way, with the exception of the SD features. That can be disabled under Prefs -> Features.

The mosquitto config is easy. Create a 'bblp' user with the PIN as the password and then:

connection bambuprinter
# Monitor topic $SYS/broker/connection/+/state for status
address IP_ADDRESS_HERE:8883
# Fetch this with: openssl s_client -showcerts -connect IP_ADDRESS_HERE:8883 </dev/null | sed -n -e '/-.BEGIN/,/-.END/ p' | tee blcert.pem
bridge_cafile /mosquitto/cert/blcert.pem
remote_password PIN_HERE

bridge_insecure true
remote_username bblp
bridge_protocol_version mqttv311
# Do not allow weird requests because it will close the connection:
notifications_local_only true
try_private false

# Printer talks on report, we talk on request. Anything else causes connection reset.
topic device/SERIAL_NUMBER_HERE/report in
topic device/SERIAL_NUMBER_HERE/request out

Describe alternatives you've considered

Turning things on and off in the correct order, octoprint connections, the printer, the slicer, unrelated computers and routers, etc. It occasionally takes many hours of effort to get a single connection to function. This doesn't completely prevent that, but fewer sources of contention are better.
Additional context

@jneilliii jneilliii added the enhancement New feature or request label Oct 29, 2024
@jneilliii
Copy link
Owner

Thanks for this, I'm more curious as to why it's taking up 3 simultaneous connections. Wonder if it was something that happened during the major refactor by an outside party or the underlying pybambu module itself doing that. Do you happen to know if you were seeing this with version 0.0.23?

https://github.com/jneilliii/OctoPrint-BambuPrinter/archive/refs/tags/0.0.23.zip

@disconn3ct
Copy link
Author

Installed that version and waited for it to get temperatures (still via Mosquitto). Took a reconnect, then it started updating. One connection.
Upgrading to rc3, it got temp after the restart without reconnecting and is taking 2 connections.

@jneilliii
Copy link
Owner

Just released version 0.1.8rc4 that hopefully reduces the connection count back to 1. Please let me know.

@disconn3ct
Copy link
Author

disconn3ct commented Oct 30, 2024

Looks like that worked. It is only using one connection now.
Edit to add: Might be unrelated but I'm running a print and it is reading the temps, but not detecting print status. The node-red flow (wolfwithsword) detects it correctly from the same broker.

@jneilliii
Copy link
Owner

The OctoPrint printing status is tied back to the file being printed, because that is how OctoPrint works with SD card printing. The plugin has to know of the file name printing and if it was sent from slicer the file list has to update. Long discussion on possible similar issue is in #52, but that seemed to be more could connected printer issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants