Skip to content

feat: enhance VRM client with MQTT support and update site permission… - #8

Merged
AndyTempel merged 9 commits into
mainfrom
feat-mqtt
Jan 17, 2026
Merged

feat: enhance VRM client with MQTT support and update site permission…#8
AndyTempel merged 9 commits into
mainfrom
feat-mqtt

Conversation

@AndyTempel

Copy link
Copy Markdown
Member

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 VRMMQTTClient class, updating dependencies, and refactoring the SitePermission model to support additional fields and flexible types.

MQTT support and client integration

  • Added victron-mqtt as a dependency and introduced the VRMMQTTClient class in victron_vrm/mqtt.py to enable MQTT communication with VRM installations. [1] [2]
  • Implemented the get_mqtt_client_for_installation method in victron_vrm/client.py to 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

  • Refactored the SitePermission model in victron_vrm/models/site.py to support additional permission fields and allow extra keys, improving compatibility with changing API responses.
  • Updated several fields in the Site model to handle API inconsistencies, such as allowing images to be a list or boolean, and view_permissions to be a list or single object. Also fixed the alias for mqtt_hostname. [1] [2]
  • Changed the type of the automatic field in SiteTag to accept both bool and str values.

Development tooling

  • Added python-dotenv to the development dependencies for easier environment variable management in development.…s model

Copilot AI review requested due to automatic review settings January 17, 2026 19:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 VRMMQTTClient wrapper class and get_mqtt_client_for_installation method
  • Fixed the SitePermission model (corrected typo in class name from SitePerrmission) and made it more flexible to handle varying API responses by allowing additional fields and making all fields optional
  • Corrected the mqtt_hostname field alias from mqttHost to mqtt_host to match the actual API response format
  • Added python-dotenv and victron-mqtt dependencies 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.

Comment thread victron_vrm/mqtt.py
Comment thread victron_vrm/client.py
Comment thread victron_vrm/client.py
AndyTempel and others added 2 commits January 17, 2026 20:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: NANI <9637751+AndyTempel@users.noreply.github.com>

Copilot AI commented Jan 17, 2026

Copy link
Copy Markdown
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.

AndyTempel and others added 5 commits January 17, 2026 20:39
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
@AndyTempel
AndyTempel merged commit 30200e5 into main Jan 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants