![]() |
|
iBMS integration - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: iBMS integration (/showthread.php?tid=6582) |
iBMS integration - ivob - 26.10.2026 Recenlly I bought an iBMS interface for reading data for my home battery system with a JK BMS. Can anyone help me with a basic script? The iBMS has an API which provides data bij HTML. I removed some data, but the structure is: { "device": "iBMS-Master", "board_type": 1, "charge_current": 100, "discharge_current": 100, "capacity_remaining": 79, "battery_soh": 100, "batteries": [{ "id": 0, "total_voltage": 53.12, "current": -0.48, "total_runtime": 17388365 }, { "id": 1, "total_voltage": 53.06, "current": 0, "total_runtime": 27409539 }] } RE: iBMS integration - admin - 27.10.2026 Try this. Change url and group address mapping as needed. Code: json = require('json')
http = require('socket.http')
url = 'http://192.168.1.1/'
res, err = http.request(url)
if not res then
log('request failed', err)
else
res, err = json.pdecode(res)
if not res then
log('failed to parse response', err)
else
grp.checkwrite('1/1/1', res.charge_current)
grp.checkwrite('1/1/2', res.discharge_current)
grp.checkwrite('1/1/3', res.capacity_remaining)
grp.checkwrite('1/1/4', res.battery_soh)
grp.checkwrite('1/2/1', res.batteries[1].total_voltage)
grp.checkwrite('1/2/2', res.batteries[1].current)
grp.checkwrite('1/3/1', res.batteries[2].total_voltage)
grp.checkwrite('1/3/2', res.batteries[2].current)
end
end |