Hello everyone,
I am trying to access information about my VenusGX, battery and Multiplus with modbusTCP and python, using the python library pymodbus, and get the error Exception Response(132, 4, GatewayPathUnavailable.
I can successfully access information about my VenusGX. For instance, with this bit of code, which accesses information about the GridSetpoint, using the VEsystemID :
ip = "172.24.24.1" VEsystemID = 10 client = ModbusClient(ip, port='502') def modbus_register(address, unit): msg = client.read_input_registers(address, unit=unit) print('message : , ', msg) decoder = BinaryPayloadDecoder.fromRegisters(msg.registers, byteorder=Endian.Big) msg = decoder.decode_16bit_int() return msg GridSetPoint = modbus_register(2700, VEsystemID) print(f"Grid Set Point: {GridSetPoint}W") DVCC_maximum_system_charge_current = modbus_register(2705, VEsystemID) print(f"DVCC_maximum_system_charge_current: {DVCC_maximum_system_charge_current}")
I get the following result, successfully getting the data :
message : , ReadInputRegistersResponse (1) Grid Set Point: 50W message : , ReadInputRegistersResponse (1) DVCC_maximum_system_charge_current: -1W
However, when I try to access my batterySOC for instance :
from pymodbus.constants import Endian from pymodbus.client import ModbusTcpClient as ModbusClient from pymodbus.payload import BinaryPayloadDecoder ip = "172.24.24.1" RefreshRate = 1 MultiPlusID = 242 BmvID = 225 VEsystemID = 100 client = ModbusClient(ip, port='502') def modbus_register(address, unit): msg = client.read_input_registers(address, unit=unit) print('message : , ', msg) decoder = BinaryPayloadDecoder.fromRegisters(msg.registers, byteorder=Endian.BIG) msg = decoder.decode_16bit_int() return msg BatterySOC = modbus_register(266, BmvID) / 10 print(f"Battery State of Charge: {BatterySOC}%") GridSetPoint = modbus_register(2700, VEsystemID) print(f"Grid Set Point: {GridSetPoint}W") DVCC_maximum_system_charge_current = modbus_register(2705, VEsystemID) print(f"DVCC_maximum_system_charge_current: {DVCC_maximum_system_charge_current}W")
I get an error, because variable "msg" receives "Exception Response(132, 4, GatewayPathUnavailable)" instead of the value of the battery State of Charge.
However, I know the unitID of my BMV is 225 (in the Modbus TCP services of the victron remote console, it shows that the unit ID of my battery is 225, and that the unit id of my multiplus is 242), and the Modbus-TCP-register list indicates that register 266 corresponds to the battery state of charge. I also tried other registers, I got the same error.
I had the same error when trying to access my Multiplus data (for instance, the Output current of phase 1 with MultiPlusID = 242 and Modbus register 18)
The Victron remote console prints an error ,
ERROR "Error processing function code 3, unit id 242,
start address 304, quantity1, src129.104.9.21: Error
finding service with device type battery at device instance
261"
Does someone have an idea of what happens ?
Thank you very much,
Theophile