Skip to content

feat: add MQTT-over-WebSocket client with real-time device telemetry decoding - #30

Merged
stuartp44 merged 5 commits into
mainfrom
copilot/add-mqtt-over-websocket-support-again
Jul 25, 2026
Merged

feat: add MQTT-over-WebSocket client with real-time device telemetry decoding#30
stuartp44 merged 5 commits into
mainfrom
copilot/add-mqtt-over-websocket-support-again

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces MQTT-over-WebSocket support to the pymbrewclient library, enabling real-time streaming and decoding of MiniBrew device telemetry. It adds a new MqttClient implementation, typed message models, and a CLI command for live device log monitoring. The documentation is updated with usage examples and security caveats. Several internal and public APIs are extended to support MQTT integration.

MQTT-over-WebSocket Integration:

  • Added a new MqttClient class and typed message models (MqttMessage, DeviceLogMessage) for real-time device telemetry over MQTT-over-WebSocket, including schema caveats and field-level documentation. (src/pymbrewclient/mqtt/client.py, src/pymbrewclient/mqtt/models.py, src/pymbrewclient/mqtt/__init__.py) [1] [2]
  • Updated project dependencies to include paho-mqtt for MQTT support. (pyproject.toml)

CLI Enhancements:

  • Added a new watch-device-logs CLI command to stream and print real-time device logs, with options for selecting devices, output format, debug mode, and duration. (src/pymbrewclient/cli.py)
  • Improved output serialization and added a utility to curate telemetry output for readability. (src/pymbrewclient/cli.py) [1] [2]

API and Public Interface Updates:

  • Extended BreweryClient with create_mqtt_client() and get_user_profile() methods to facilitate MQTT credential generation and user profile access. (src/pymbrewclient/client.py)
  • Updated __init__.py exports to include the new MQTT client and models, and to expose UserProfile in the public API. (src/pymbrewclient/__init__.py)

Documentation:

  • Added comprehensive documentation and code examples for MQTT usage, security considerations, and protobuf schema limitations. (docs/API_EXAMPLES.md)

These changes collectively enable robust, real-time monitoring of MiniBrew devices through both code and the command line, and lay the groundwork for further MQTT-based features.

Copilot AI changed the title feat: add MQTT-over-WebSocket support with device telemetry decoding feat: MQTT-over-WebSocket client with real-time device telemetry decoding Jul 25, 2026
Copilot AI requested a review from stuartp44 July 25, 2026 17:56
@github-actions

Copy link
Copy Markdown

Thanks for opening this pull request, @Copilot!

A maintainer will review your PR soon. In the meantime, please make sure:

  • Your code follows the project's style guidelines
  • You've added/updated tests as needed
  • Your commit messages follow Conventional Commits
  • You've updated documentation if necessary

Feel free to ask questions if you need help!

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@stuartp44 stuartp44 changed the title feat: MQTT-over-WebSocket client with real-time device telemetry decoding feat: add MQTT-over-WebSocket client with real-time device telemetry decoding Jul 25, 2026
@stuartp44

Copy link
Copy Markdown
Owner

@copilot can you add the ability for the new MQTT over WS via the cli?

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you add the ability for the new MQTT over WS via the cli?

Done — added a watch-device-logs command to the CLI in commit feat: add watch-device-logs CLI command for real-time MQTT telemetry.

Usage:

pymbrewclient watch-device-logs \
  --username you@example.com \
  --password secret \
  --serial 2403K0561-61BMUWBU

Options:

  • --serial — device serial number to watch; can be specified multiple times for multiple devices
  • --formatpretty (default) or json
  • --duration — stop automatically after N seconds (default: run until Ctrl+C)

Also fixed serialize_output to convert bytes → hex string so DeviceLogMessage.payload serializes cleanly in JSON output.

- Updated the MQTT client to include Wi-Fi RSSI and next action timestamps in device log messages.
- Improved the decoding of telemetry fields, including measurements and nested state values.
- Added a curated output function for device logs to simplify the displayed information.
- Adjusted the CLI to support a debug mode that reveals all fields in the device log output.
- Modified the REST API client to fetch user profiles from the correct endpoint.
- Removed outdated binary fixture and replaced it with hex representation for better readability.
- Enhanced unit tests to cover new telemetry fields and ensure accurate decoding of device logs.
@stuartp44
stuartp44 marked this pull request as ready for review July 25, 2026 20:54
@stuartp44
stuartp44 force-pushed the copilot/add-mqtt-over-websocket-support-again branch from 4ad796f to c118bce Compare July 25, 2026 21:02
@stuartp44
stuartp44 merged commit 5a376cb into main Jul 25, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.10.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants