Search code examples
modbusmodbus-tcppymodbuspymodbus3pymodbustcp

Problem establishing connection over Python Modbus TCP to a Mitsubishi Inverter


I am trying to establish a Modbus connection from a laptop to a Mitsubishi inverter (FR A-800 E series) (the manual for this connection can be found [here][1])

I am using pymodbus and I can establish a connection, but the problem comes when I try to read a register.

I know I am connection because doing something like:

from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient('192.168.15.10', 502)
client.connect()

results in a

True

response. Also, if I just print client it returns the details of the connection, which makes me confident the connection is properly establish. But, whenever I try to read a register (which I am confident exists, since it appears in the manual) :

result=client.read_holding_registers(9,1,1)
print(result)

I would obtain:

Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

and if I try again,

Modbus Error: [Input/Output] No Response received from the remote unit/unable to decode response.

Does anyone have any idea? I have tried with a bunch of addresses for the registers, I have tried including not including the 1,1) part when reading the register and got no luck.

[1]: https://dl.mitsubishielectric.com/dl/fa/document/manual/inv/ib0600628eng/ib0600628engd.pdf)


Solution

  • As per the comments, the manual says "Unit identifier Fixed to 255" so use that (client.read_holding_registers(9,1,255)).

    Some ModbusTCP devices ignore this but sometimes you need to specify the correct value in order to get a response.