feat: enhance VRM client with MQTT support and update site permission… - #8
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the VRM client with MQTT support and improves the data models to handle API inconsistencies. The changes introduce MQTT communication capabilities for VRM installations while also fixing several issues with the API response handling.
Changes:
- Added MQTT client support via a new
VRMMQTTClientwrapper class andget_mqtt_client_for_installationmethod - Fixed the
SitePermissionmodel (corrected typo in class name fromSitePerrmission) and made it more flexible to handle varying API responses by allowing additional fields and making all fields optional - Corrected the
mqtt_hostnamefield alias frommqttHosttomqtt_hostto match the actual API response format - Added
python-dotenvandvictron-mqttdependencies to support the new functionality
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| victron_vrm/mqtt.py | Introduces new VRMMQTTClient class that wraps the victron-mqtt Hub for VRM-specific MQTT communication |
| victron_vrm/models/site.py | Fixes typo in SitePermission class name, makes permission fields optional with extra field support, fixes mqtt_hostname alias, and adds flexibility for images and view_permissions fields to handle API inconsistencies |
| victron_vrm/client.py | Adds get_mqtt_client_for_installation method to create and configure MQTT clients for specific installations with proper error handling |
| pyproject.toml | Updates project description and adds victron-mqtt==2026.1.2 and python-dotenv>=1.0.0 dependencies |
| uv.lock | Updates lock file with new dependencies (paho-mqtt, python-dotenv, victron-mqtt) and version bump to 0.1.8 |
| mqtt_playground.ipynb | Adds example notebook demonstrating basic VRM MQTT functionality usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: NANI <9637751+AndyTempel@users.noreply.github.com>
Contributor
|
@AndyTempel I've opened a new pull request, #9, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: AndyTempel <9637751+AndyTempel@users.noreply.github.com>
Co-authored-by: AndyTempel <9637751+AndyTempel@users.noreply.github.com>
Add test coverage for get_mqtt_client_for_installation method
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.
This pull request adds MQTT client support for VRM installations and makes several improvements to the data models to handle API inconsistencies. The main changes include introducing a new
VRMMQTTClientclass, updating dependencies, and refactoring theSitePermissionmodel to support additional fields and flexible types.MQTT support and client integration
victron-mqttas a dependency and introduced theVRMMQTTClientclass invictron_vrm/mqtt.pyto enable MQTT communication with VRM installations. [1] [2]get_mqtt_client_for_installationmethod invictron_vrm/client.pyto create and return an MQTT client for a given installation, including error handling for missing installations or MQTT hostnames.Data model improvements and API consistency
SitePermissionmodel invictron_vrm/models/site.pyto support additional permission fields and allow extra keys, improving compatibility with changing API responses.Sitemodel to handle API inconsistencies, such as allowingimagesto be a list or boolean, andview_permissionsto be a list or single object. Also fixed the alias formqtt_hostname. [1] [2]automaticfield inSiteTagto accept bothboolandstrvalues.Development tooling
python-dotenvto the development dependencies for easier environment variable management in development.…s model