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 c9b5a7b commit ec0e888
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## v0.0.4
* Changed: Add VRM ID to MQTT client name
* Changed: Fix registration to dbus https://github.com/victronenergy/velib_python/commit/494f9aef38f46d6cfcddd8b1242336a0a3a79563

## v0.0.3
Expand Down
12 changes: 9 additions & 3 deletions dbus-mqtt-temperature/dbus-mqtt-temperature.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 @@ -200,7 +201,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.0.3 (20240702)")
self._dbusservice.add_path("/FirmwareVersion", "0.0.4 (20240819)")
# self._dbusservice.add_path('/HardwareVersion', '')
self._dbusservice.add_path("/Connected", 1)

Expand Down Expand Up @@ -281,7 +282,12 @@ def main():
DBusGMainLoop(set_as_default=True)

# MQTT setup
client = mqtt.Client("MqttTemperature_" + str(config["DEFAULT"]["device_instance"]))
client = mqtt.Client(
"MqttTemperature_"
+ 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 ec0e888

Please sign in to comment.