ModbusTcpClient: broken pipe error

814 views
Skip to first unread message

sara moghadam

unread,
Jun 9, 2019, 3:16:35 AM6/9/19
to pymodbus
I have this code to connect to my sunny boy inverter.

"""
from pymodbus.client.sync import ModbusTcpClient

client = ModbusTcpClient(ip,
                         timeout=config.timeout,
                         RetryOnEmpty=True,
                         retries=3,
                         port=502)
print ("Connect")
client.connect()
time.sleep(5)

rr= client.read_input_registers(address=30775,  count=2, unit=3)
"""
but I'm getting a broken pipe error as follow:

""""""""""""""
2019-06-09 06:43:33,042 MainThread      DEBUG    transaction    :111      Current transaction state - IDLE
2019-06-09 06:43:33,042 MainThread      DEBUG    transaction    :116      Running transaction 1
2019-06-09 06:43:33,042 MainThread      DEBUG    transaction    :215      SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x78 0x37 0x0 0x2
2019-06-09 06:43:33,043 MainThread      DEBUG    sync           :73       New Transaction state 'SENDING'
2019-06-09 06:43:33,043 MainThread      DEBUG    transaction    :234      Transaction failed. ([Errno 32] Broken pipe) 
2019-06-09 06:43:33,043 MainThread      DEBUG    socket_framer  :147      Processing: 
2019-06-09 06:43:33,043 MainThread      DEBUG    transaction    :390      Getting transaction 1
2019-06-09 06:43:33,044 MainThread      DEBUG    transaction    :189      Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE

""""""""""""""""""
I have tried both python 2.7 and 3.7 and modbus 2.1.0. I have also tried other uid and addresses on the same cluster, but the same error for all. I appreciate any suggestions and help on this.
thanks

sanju dhoomakethu

unread,
Jun 10, 2019, 11:30:17 PM6/10/19
to pymo...@googlegroups.com
This generally happens when the socket is closed on the slave side (i.e the inverter ). See if you are reading on the correct port or try using a higher value for read timeout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/pymodbus/a47a9dbf-0133-4333-a31b-78339961e9a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages