Skip to content

Commit 8538296

Browse files
committed
raise ModbusError when read structure is wrong
1 parent 9e5c62b commit 8538296

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

modbus_tcp/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ def __read_Registers(self, regPara: dict):
601601
self.logger.error(f"Number of bits or datatype not supported : {dataTypeStr}")
602602
except struct.error as e:
603603
self.logger.error(f"unable to unpack data for datatype={dataType.lower()} for read {objectType}.{address}.{slaveUnit} (address.slaveUnit) regCount:{registerCount}")
604+
raise ModbusException(f"Exception: unable to unpack data for datatype={dataType.lower()} for read {objectType}.{address}.{slaveUnit} (address.slaveUnit) regCount:{registerCount}")
604605

605606
@staticmethod
606607
def is_NaN( value, dataType: str) -> bool:

modbus_tcp/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugin:
1111
keywords: modbus_tcp modbus tcp smartmeter inverter heatpump
1212
#documentation: http://smarthomeng.de/user/plugins/modbus_tcp/user_doc.html
1313
support: https://knx-user-forum.de/forum/supportforen/smarthome-py/1154368-einbindung-von-modbus-tcp
14-
version: 1.0.14 # Plugin version
14+
version: 1.0.15 # Plugin version
1515
sh_minversion: '1.10' # minimum shNG version to use this plugin
1616
#sh_maxversion: # maximum shNG version to use this plugin (leave empty if latest)
1717
py_minversion: '3.8'

0 commit comments

Comments
 (0)