Skip to content

Commit

Permalink
Changed: Add VRM ID to MQTT client name
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Aug 19, 2024
1 parent 2ac7356 commit 2beaf7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## v0.1.6
* Added: Set device type to `grid`, `genset` or `acload`
* Changed: Add VRM ID to MQTT client name
* Changed: Fix registration to dbus https://github.com/victronenergy/velib_python/commit/494f9aef38f46d6cfcddd8b1242336a0a3a79563

## v0.1.5
Expand Down
7 changes: 4 additions & 3 deletions dbus-mqtt-grid/dbus-mqtt-grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

# import Victron Energy packages
sys.path.insert(1, os.path.join(os.path.dirname(__file__), "ext", "velib_python"))
from vedbus import VeDbusService
from vedbus import VeDbusService # noqa: E402
from ve_utils import get_vrm_portal_id # noqa: E402


# get values from config.ini file
Expand Down Expand Up @@ -406,7 +407,7 @@ def __init__(
self._dbusservice.add_path("/ProductId", 0xFFFF)
self._dbusservice.add_path("/ProductName", productname)
self._dbusservice.add_path("/CustomName", customname)
self._dbusservice.add_path("/FirmwareVersion", "0.1.6 (20240703)")
self._dbusservice.add_path("/FirmwareVersion", "0.1.6 (20240819)")
# self._dbusservice.add_path('/HardwareVersion', '')
self._dbusservice.add_path("/Connected", 1)

Expand Down Expand Up @@ -617,7 +618,7 @@ def main():
DBusGMainLoop(set_as_default=True)

# MQTT setup
client = mqtt.Client("MqttGrid_" + str(config["DEFAULT"]["device_instance"]))
client = mqtt.Client("MqttGrid_" + get_vrm_portal_id() + "_" + str(config["DEFAULT"]["device_instance"]))
client.on_disconnect = on_disconnect
client.on_connect = on_connect
client.on_message = on_message
Expand Down

0 comments on commit 2beaf7b

Please sign in to comment.