fix: make WebSocket path configurable for EMQX compatibility#307
Open
bplein wants to merge 3 commits into
Open
fix: make WebSocket path configurable for EMQX compatibility#307bplein wants to merge 3 commits into
bplein wants to merge 3 commits into
Conversation
The hardcoded path "/" caused WebSocket handshakes to fail with EMQX, which serves MQTT over WebSocket at /mqtt. Add a ws_path config option (defaulting to /mqtt) so the integration works with both EMQX and broker deployments that use a different WebSocket path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
andyshinn
reviewed
Jul 10, 2026
| client_id_prefix: str | ||
| topic_status: str | ||
| topic_packets: str | ||
| ws_path: str = "/mqtt" |
Contributor
There was a problem hiding this comment.
The existing default was / and this changes the new default to /mqtt. It might make sense to change the default to / unless we know that /mqtt is what most users are already using.
Author
There was a problem hiding this comment.
That does make sense. I’ll make the change today.
Author
There was a problem hiding this comment.
There were additional places where this incorrect default was set. Fixed and tested with 4f79a85
Co-authored-by: Andy Shinn <andys@andyshinn.as>
Initial commits defaulted to /mqtt, these revert it to default to / which is the old behavior.
bplein
marked this pull request as draft
July 10, 2026 15:57
Author
|
Converted to draft, unexpected issue I need to resolve on my end (may not be related to the PR itself) |
Author
|
Errors were configuration issues on EMQX. |
bplein
marked this pull request as ready for review
July 10, 2026 17:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/mqttinstead of/ws_pathbroker config option (default:/for backwards compatibility)/on next save, maintaining compatibility with most broker deployments.Context
The hardcoded
ws_set_options(path="/", ...)caused the Home Assistant integration to fail when connecting to EMQX, which expects WebSocket connections at the/mqttpath. This is the default WebSocketendpoint for EMQX deployments.
Changes
mqtt_uploader.py: Addedws_pathfield toBrokerConfigwith default/mqtt_uploader.py: Passws_pathfrom broker settings when creatingBrokerConfigmqtt_uploader.py: Usebroker.ws_pathinstead of hardcoded/inws_set_optionsconfig_flow.py: Addedws_pathfield to broker config UI formconfig_flow.py: Persistws_pathvalue when saving broker configurationTesting
/mqttws_pathdefault to/Admission of Guilt