Repository navigation
Adds the ability for to connect to an MQTT broker via WS/WSS - #2965
Conversation
… broker via WS/WSS
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2965 +/- ##
=======================================
Coverage 99.76% 99.76%
=======================================
Files 300 300
Lines 26429 26480 +51
=======================================
+ Hits 26367 26419 +52
+ Misses 62 61 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
ESPHome Bot (@esphbot) review |
|
❌ Permission denied. Only users with write access can trigger bot commands. |
|
ESPHome Bot (@esphbot) review |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
There was a problem hiding this comment.
🟡 Changes recommended
Valid mixed-case and package-substituted transport settings can select the wrong connection mode or prevent WebSocket connections.
2 open issues
What changed in this PR
Adds MQTT-over-WebSocket support to Device Builder’s status monitoring, aligning broker connections with ESPHome’s WS/WSS configuration.
Changes:
- Parses transport and WebSocket path settings and includes them in broker grouping.
- Configures Paho WebSocket connections and enables TLS for WSS.
- Adds parsing and connection tests while updating existing client fakes.
| File | Description |
|---|---|
tests/test_mqtt_monitor.py |
Tests WS/WSS parsing, paths, transport selection, and TLS behavior. |
esphome_device_builder/controllers/_device_mqtt_monitor.py |
Adds WebSocket connections, WSS TLS, and transport-aware logging. |
esphome_device_builder/controllers/_device_mqtt_coordinator.py |
Reads transport/path settings and groups monitors by endpoint. |
Review effort: Balanced
Ensure MQTT transport type is lowercase. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
| block = merged | ||
| return yaml_stat, block, extract.main_substitutions |
There was a problem hiding this comment.
Fixed in f28efa5.
There was a problem hiding this comment.
Verified fixed. Line 503 merges package subs. Main-file subs still win. Regression test covers port and username.
…file ones winning
|
ESPHome Bot (@esphbot) review |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
ESPHome Bot (@esphbot) review |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
ESPHome Bot (@esphbot) review |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
Note No code changes since the last review ( |
…fuse unshaped ws_path A device with packages: whose main mqtt: block leaves transport, port, certificate_authority, ws_path or skip_cert_cn_check unset could connect from the main block alone when no package-merged block was carried, sending credentials over plain TCP when a package set transport: wss. A shallow extract now waits for the deep reload, a failed deep parse refuses the broker with the unresolved warning, and the stale re-read path requests a reload. The extract records whether the main file has packages: so the fresh path needs no file read. A ws or wss ws_path that does not start with "/" now refuses the broker instead of reaching the broker key and paho.
|
ESPHome Bot (@esphbot) review |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
… the package hold
|
Addressed in fba5694:
ESPHome Bot (@esphbot) review |
Both verified fixed in fba5694. Re-read path passes |
PR Review — Adds the ability for to connect to an MQTT broker via WS/WSSReady to merge. Commit fba5694 fixes the open HIGH finding and the narrowing suggestion from the last review, and I found no new issues. What the PR does well:
What needs attention: nothing blocking. A package device whose main block leaves ✅ Resolved since last review (1)Previously-flagged issues verified fixed
Checklist
Silent Failure Analysis
🟡 **1. MEDIUM** — permanent refusal on transient failure
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.


What does this implement/fix?
Adds the ability for ESPHome Device Builder to connect to the MQTT broker via WS/WSS in accordance with the implementation in esphome/esphome#16056.
With this, it is possible to display the status (online/offline) and logs of devices connected via MQTT over WebSockets.
Related issue or feature (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocsmaintenancecidependenciesFrontend coordination
Checklist
ruff,codespell, yaml/json/python checks).tests/where applicable.components.index.json/definitions/components/*.jsonhave not been hand-edited (regenerate viascript/sync_components.pyif a sync is needed).docs/ARCHITECTURE.mdand/ordocs/API.md.