Skip to content

Commit a49c684

Browse files
Update ExceptionResponse import for pymodbus 3.11
1 parent c198542 commit a49c684

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

custom_components/solaredge_modbus_multi/hub.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
from pymodbus.client import AsyncModbusTcpClient
1515
from pymodbus.client.mixin import ModbusClientMixin
1616
from pymodbus.exceptions import ConnectionException, ModbusIOException
17-
from pymodbus.pdu import ExceptionResponse
17+
try:
18+
from pymodbus.pdu.pdu import ExceptionResponse
19+
except ImportError:
20+
from pymodbus.pdu import ExceptionResponse
1821

1922
from .const import (
2023
BATTERY_REG_BASE,
@@ -528,6 +531,11 @@ async def modbus_read_holding_registers(self, unit, address, rcount):
528531

529532
sig = inspect.signature(self._client.read_holding_registers)
530533

534+
_LOGGER.debug(
535+
f"I{self._rr_unit}: modbus_read_holding_registers "
536+
f"address={self._rr_address} count={self._rr_count}"
537+
)
538+
531539
if "device_id" in sig.parameters:
532540
result = await self._client.read_holding_registers(
533541
address=self._rr_address, count=self._rr_count, device_id=self._rr_unit
@@ -537,7 +545,15 @@ async def modbus_read_holding_registers(self, unit, address, rcount):
537545
address=self._rr_address, count=self._rr_count, slave=self._rr_unit
538546
)
539547

548+
_LOGGER.debug(
549+
f"I{self._rr_unit}: result is error: {result.isError()} "
550+
)
551+
540552
if result.isError():
553+
_LOGGER.debug(
554+
f"I{self._rr_unit}: error result: {type(result)} "
555+
)
556+
541557
if type(result) is ModbusIOException:
542558
raise ModbusIOError(result)
543559

custom_components/solaredge_modbus_multi/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"issue_tracker": "https://github.com/WillCodeForCats/solaredge-modbus-multi/issues",
1111
"loggers": ["custom_components.solaredge_modbus_multi"],
1212
"requirements": ["pymodbus>=3.8.3"],
13-
"version": "3.1.6"
13+
"version": "3.2.0-pre.1"
1414
}

0 commit comments

Comments
 (0)