Skip to content

Commit da66c66

Browse files
authored
Merge pull request #341 from sfstar/bump-minimum-version-and-add-2-versions-compatibility
initial attempt at supporting core 2025.2 till 2025.6 and 2025.7
2 parents 3d4db88 + 1b9fa92 commit da66c66

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

custom_components/victron/hub.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import logging
55
import threading
66

7+
from packaging import version
8+
import pymodbus
79
from pymodbus.client import ModbusTcpClient
810

911
from homeassistant.exceptions import HomeAssistantError
@@ -37,8 +39,12 @@ def is_still_connected(self):
3739

3840
def convert_string_from_register(self, segment, string_encoding="ascii"):
3941
"""Convert from registers to the appropriate data type."""
42+
if version.parse("3.8.0") <= version.parse(pymodbus.__version__) <= version.parse("3.8.4"):
43+
return self._client.convert_from_registers(
44+
segment, self._client.DATATYPE.STRING
45+
).split("\x00")[0]
4046
return self._client.convert_from_registers(
41-
segment, self._client.DATATYPE.STRING, string_encoding="ascii"
47+
segment, self._client.DATATYPE.STRING, string_encoding=string_encoding
4248
).split("\x00")[0]
4349

4450
def convert_number_from_register(self, segment, dataType):

custom_components/victron/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"iot_class": "local_polling",
1313
"issue_tracker": "https://github.com/sfstar/hass-victron/issues",
1414
"requirements": [
15-
"pymodbus>=3.7.4"
15+
"pymodbus>=3.8.0"
1616
],
1717
"ssdp": [],
1818
"version": "v0.0.0",

hacs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"zip_release": true,
55
"filename": "victron.zip",
66
"hide_default_branch": false,
7-
"homeassistant": "2025.1",
7+
"homeassistant": "2025.2",
88
"hacs": "1.28.4"
99
}

0 commit comments

Comments
 (0)