The following functions provide a mapping of the Modbus Registers to HTTP.
Note: Modbus does not need to be active to use the HTTP API.
Use a HTTP GET or POST request to the address of the cFos Charging Controller, e.g.http://192.168.2.111/cnf?cmd=modbus&device=meter1&read=35154
.
Responses are in JSON.
cmd
is always modbusdevice
= meter1 or meter2 or evseread
= address of the register to readwrite
= address of the register to readvalue
= value to writevalues
= array of values to write, e.g. [1,2,3,4]Addresses can have a suffix to specify the data type (default is 16 bit integer):
d
= 32 bit integer (2 modbus registers)q
= 64 bit integer (4 modbus registers)s
= string/cnf?cmd=modbus&device=meter1&read=8002
Response:
1
/cnf?cmd=modbus&device=meter1&read=8062d
Response:
-1
/cnf?cmd=modbus&device=meter1&read=8016s
Response:
"cFos Power Brain"
/cnf?cmd=modbus&device=meter1&read=8002&count=10
Response:
[1,257,256,0,256,0,26211,26165,11619,13366]
/cnf?cmd=modbus&device=meter2&read=all
Response:
{"8000d":-821755904,"8002":1,"8003":257,"8004":16777216,"8006":256,"8007":0,"8008s":"fcf5-c46d-310c","8016s":"cFos Power Brain","8040":41,"8041":1,"8042d":1000,"8044":1,"8045":230,"8046":230,"8047":230,"8050q":0,"8054d":0,"8056":0,"8057":0,"8058q":0,"8062d":-1,"8064d":0,"8066d":0,"8068d":0,"8070":0,"8071":0,"8120d":0}
/cnf?cmd=modbus&device=evse&write=8044&value=7
Response:
"ok"
/cnf?cmd=modbus&device=evse&write=8050q&value=1"
Response:
"ok"
/cnf?cmd=modbus&device=evse&write=8044d&value=1"
Response:
"bad modbus register size"
/cnf?cmd=modbus&device=evse&write=8044&values=[7,230,230,230 ]
Response:
"ok"