Hi,
I am trying to read a sma inverters the datasheets says:
holding register address 30771 , if I read the same value using modscan tool I am able to read the value.
When I am trying the same address with the pymodbus (1.2.0) with below code I found:
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusSerialClient as mbc
client = mbc(method='rtu', port = '/dev/ttyUSB0', stopbits=1, bytesize=8, parity='N', baudrate=9600)
connection = client.connect()
print connection
rr = client.read_holding_registers(430771, 4, unit=3)
print rr.registers
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
True
Traceback (most recent call last):
File "test_inverter.py", line 11, in <module>
rr = client.read_holding_registers(430771, 4, unit=3)
File "/usr/lib/python2.7/dist-packages/pymodbus/client/common.py", line 109, in read_holding_registers
return self.execute(request)
File "/usr/lib/python2.7/dist-packages/pymodbus/client/sync.py", line 83, in execute
return self.transaction.execute(request)
File "/usr/lib/python2.7/dist-packages/pymodbus/transaction.py", line 64, in execute
self.client._send(self.client.framer.buildPacket(request))
File "/usr/lib/python2.7/dist-packages/pymodbus/transaction.py", line 549, in buildPacket
data = message.encode()
File "/usr/lib/python2.7/dist-packages/pymodbus/register_read_message.py", line 32, in encode
return struct.pack('>HH', self.address, self.count)
struct.error: 'H' format requires 0 <= number <= 65535
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I am tried to read 30803 it gives value none.
I am attaching the snap shot of the modscan tool where I am getting value from 430771 onwards.
How to remove the offset value from the 430771 (extended modbus address 6 digit) , correct me If i am worong in below
430771 - 400001 = 30770
If i read the 30770 as a holding register output is none.