-
-
Notifications
You must be signed in to change notification settings - Fork 9
SH8.0RT "write holding register" supported? #4
Description
I tried to write to to holding register via SungrowModbusWebClient 0.3.2 and modified Modbus4mqtt.
Reading input and holding registers is working like a sharm
But writing to holding registers throws an error like attached.
Any hint? O.
2023-05-14 13:37:54 ERROR Failed to write to modbus device: cannot access local variable 'param_type' where it is not associated with a value
Traceback (most recent call last):
File "/modbus4mqtt/modbus_interface.py", line 234, in _process_writes
self._mb.write_register(addr, value, unit=0x01)
File "/usr/local/lib/python3.11/site-packages/pymodbus/client/common.py", line 92, in write_register
return self.execute(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pymodbus/client/sync.py", line 109, in execute
return self.transaction.execute(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pymodbus/transaction.py", line 174, in execute
response, last_exception = self._transact(
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pymodbus/transaction.py", line 274, in _transact
size = self._send(packet)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pymodbus/transaction.py", line 309, in _send
return self.client.framer.sendPacket(packet)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pymodbus/framer/init.py", line 41, in sendPacket
return self.client.send(message)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pymodbus/client/sync.py", line 78, in send
return self._send(request)
^^^^^^^^^^^^^^^^^^^
File "/modbus4mqtt/SungrowModbusWebClient_patched.py", line 136, in _send
logging.debug("param_type: " + str(param_type) + ", start_address: " + str(address) + ", count: " + str(count) + ", dev_id: " +str(dev_id))
^^^^^^^^^^
UnboundLocalError: cannot access local variable 'param_type' where it is not associated with a value