From 133dd3bba5fc2cfd27e96d34af060b66216c3561 Mon Sep 17 00:00:00 2001 From: sfstar Date: Sat, 5 Jul 2025 21:45:12 +0000 Subject: [PATCH 1/2] initial attempt at supporting core 2025.2 till 2025.6 and 2025.7 --- custom_components/victron/manifest.json | 2 +- hacs.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/victron/manifest.json b/custom_components/victron/manifest.json index 63a96f9..49c4548 100644 --- a/custom_components/victron/manifest.json +++ b/custom_components/victron/manifest.json @@ -12,7 +12,7 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/sfstar/hass-victron/issues", "requirements": [ - "pymodbus>=3.7.4" + "pymodbus>=3.8.0" ], "ssdp": [], "version": "v0.0.0", diff --git a/hacs.json b/hacs.json index 65d07db..052a252 100644 --- a/hacs.json +++ b/hacs.json @@ -4,6 +4,6 @@ "zip_release": true, "filename": "victron.zip", "hide_default_branch": false, - "homeassistant": "2025.1", + "homeassistant": "2025.2", "hacs": "1.28.4" } \ No newline at end of file From 1b9fa9246a97e89ad91c2587651ddc607aa7b9ad Mon Sep 17 00:00:00 2001 From: sfstar Date: Sat, 5 Jul 2025 21:58:39 +0000 Subject: [PATCH 2/2] add version check for breaking function --- custom_components/victron/hub.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/victron/hub.py b/custom_components/victron/hub.py index c28f500..6fb6d84 100644 --- a/custom_components/victron/hub.py +++ b/custom_components/victron/hub.py @@ -4,6 +4,8 @@ import logging import threading +from packaging import version +import pymodbus from pymodbus.client import ModbusTcpClient from homeassistant.exceptions import HomeAssistantError @@ -37,8 +39,12 @@ def is_still_connected(self): def convert_string_from_register(self, segment, string_encoding="ascii"): """Convert from registers to the appropriate data type.""" + if version.parse("3.8.0") <= version.parse(pymodbus.__version__) <= version.parse("3.8.4"): + return self._client.convert_from_registers( + segment, self._client.DATATYPE.STRING + ).split("\x00")[0] return self._client.convert_from_registers( - segment, self._client.DATATYPE.STRING, string_encoding="ascii" + segment, self._client.DATATYPE.STRING, string_encoding=string_encoding ).split("\x00")[0] def convert_number_from_register(self, segment, dataType):