Wed Jun 08, 2022 11:58 pm
There are two separate functions:
A Modbus TCP server to serial port gateway: /iot modbus set which takes parameters disabled, hardware-port, tcp-port, timeout.
A Modbus client: /iot modbus read-holding-registers which takes parameters ip, port, num-regs, reg-addr, slave-id, timeout (plus the usual actions append, as-value, do, duration, file, interval, once, without-paging). The documentation is really poor and incomplete, the final paragraph only mentions num-regs, reg-addr, slave-id parameters for the client.
I suspect that the client defaults to ip=127.0.0.1 port=502 so by default the client uses the internal server as a gateway to issue the requests though a serial port. If this is indeed the case you do not have to set up the server at all, just specify the IP address of your meter. The main issue is that currently only read-holding-registers (function code 3) is implemented, you need read-inpt-registers (function code 4).