How to read holding register address 430771 (6 Digit) using pymodbus..??

922 views
Skip to first unread message

aks...@dataglen.com

unread,
Jan 10, 2019, 12:11:04 AM1/10/19
to pymodbus
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.
WhatsApp Image 2019-01-09 at 5.17.45 PM.jpeg

Sanju !!

unread,
Jan 10, 2019, 12:38:08 AM1/10/19
to pymodbus
I am not sure if the extended address is supported by pymodbus, But Can you give it a try with pymodbus 2.1.0 and see if that helps ? 
Also , please enable the debug logs and share it here (reads with offset).

Akash Agarwal

unread,
Jan 10, 2019, 10:46:44 AM1/10/19
to pymo...@googlegroups.com
Try using absolute address value or hex value of the address.

--
You received this message because you are subscribed to the Google Groups "pymodbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymodbus+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Galen Collins

unread,
Jan 10, 2019, 5:48:04 PM1/10/19
to pymo...@googlegroups.com
Could you link your datasheet, also just try the  30771 register and see if that works. The modbus protocol doesn't actually allow for sending addresses greater than 2^16, so treat the leading 4 as server documentation more than anything else.

aks...@dataglen.com

unread,
Jan 10, 2019, 11:29:21 PM1/10/19
to pymodbus
This is the datasheet for my device
SMA_Modbus-TI-en-14.pdf

aks...@dataglen.com

unread,
Jan 11, 2019, 7:53:03 AM1/11/19
to pymodbus

Dear All,

Thanks for your suggestions...

After shifting the device to modbus tcp the issue got resolved.
Our Device was not on actual Modbus Rs485 it was running on some customize protocol designed by its provider.
We connect one converter box , which is having modbus tcp output.
We also find the pymodbus(1.2.0) is working fine with the extended modbus address also.
We need to give address as 
client.read_input_registers(30803 , 4, unit=3)

Akash Banaulikar

unread,
May 4, 2020, 1:32:35 PM5/4/20
to pymodbus
client.read_input_registers(30803 , 4, unit=3)
Can you tell me why didi you choose 30803 when you want to read 430771
Reply all
Reply to author
Forward
0 new messages