I am using modbus RTU to read an MFM meter (WL4440 from LnT). I furst tested it using modscan and it is giving correct result :
However, when using pymodbus (on windows) I am getting zero in register 40140 and 40141 (the value should be non zero as per modscan). I turned on logging in pymodbus script and am getting the following result (the logs were too big, so uploaded a text file on drive):
On the other when trying with pymodbus on rpi I'm getting the following response :
> gridinsight@GI-ED-01:~/edge_device $ bin/python main_read.py
True
DEBUG:pymodbus.logging:Current transaction state - IDLE
DEBUG:pymodbus.logging:Running transaction 0
DEBUG:pymodbus.logging:SEND: 0x1 0x3 0x9c 0xcd 0x0 0x1 0x3b 0xa5
DEBUG:pymodbus.logging:New Transaction state "SENDING"
DEBUG:pymodbus.logging:Changing transaction state from "SENDING" to "WAITING FOR REPLY"
DEBUG:pymodbus.logging:Changing transaction state from "WAITING FOR REPLY" to
"PROCESSING REPLY"
DEBUG:pymodbus.logging:RECV: 0x1 0x3 0x2 0x0 0x0 0x0 0x0
DEBUG:pymodbus.logging:Processing: 0x1 0x3 0x2 0x0 0x0 0x0 0x0
DEBUG:pymodbus.logging:Frame check failed, ignoring!!
DEBUG:pymodbus.logging:Frame check failed, ignoring!!
DEBUG:pymodbus.logging:Short frame: 0x1 0x3 0x2 0x0 0x0 0x0 0x0 wait for more data
DEBUG:pymodbus.logging:Processing: 0x0 0x0 0x0
DEBUG:pymodbus.logging:Short frame: 0x0 0x0 0x0 wait for more data
DEBUG:pymodbus.logging:Getting transaction 0
DEBUG:pymodbus.logging:Changing transaction state from "PROCESSING REPLY" to
"TRANSACTION_COMPLETE"
Modbus Error: [Input/Output] No Response received from the remote slave/Unable to
decode response
gridinsight@GI-ED-01:~/edge_device $
Python code on windows :
from pymodbus import framer
import logging
import logging.handlers as Handlers
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)
from pymodbus.client import ModbusSerialClient
ip='192.168.1.25'
port = 1502
slave_id=1
#rtu_port = '/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0'
rtu_port = 'COM5'
rtu_client =
ModbusSerialClient(port=rtu_port,framer=framer.FramerType.RTU,baudrate=9600,
timeout=3,parity='E',stopbits=1,handle_local_echo=False)
print(rtu_client.connect())
read_Data =rtu_client.read_holding_registers(address=40141,count=1,slave=1)
print(read_Data.registers)
rtu_client.close()
I used the same python code with a growwatt solar inverter and there it is working perfectly fine.
address=40141,count=1toaddress=140,count=2(Modscan, and the device docs, use Modicon Notation). The response looks invalid (would expect an error back), but devices don't always handle unsupported requests in the expected way. Based on docs online this value is spread over two registers.