![]() |
|
Jullix - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Jullix (/showthread.php?tid=5885) |
Jullix - Danny - 12.02.2025 Dear reader, I want to read an equalizer for the solar panels and battery storage. I get data in my log via the script below. Code: json = require('json')
ltn12 = require('ltn12')
http = require('socket.http')
token = 'xxxx'
url = 'https://mijn.jullix.be/api/v1/actual/..install number/detail/grid'
resp = {}
res, code = http.request({
url = url,
method = 'GET',
headers = {
authorization = 'Bearer ' .. token,
},
sink = ltn12.sink.table(resp),
})
resp = table.concat(resp)
resp = json.pdecode(resp)
log(resp)* table: ["data"] * table: ["energy_out"] * number: 10798.2729492188 ["captar_actual"] * number: 0 ["meter"] * string: E00770007307733 ["power"] * number: 0.189000010490417 ["energy_in"] * number: 16785.4638671875 ["gas"] * number: 0 ["water"] * number: 2088.42895507812 ["captar_max"] * number: 0 ["status"] * string: ok How can I get this script so that I can get all the data to a group address? So also the other links as on this website https://mijn.jullix.be/apidocs/ Thank you! RE: Jullix - RomansP - 12.02.2025 Hi, Here is a code Code: json = require('json')
ltn12 = require('ltn12')
http = require('socket.http')
token = 'xxxx'
url = 'https://mijn.jullix.be/api/v1/actual/..install number/detail/grid'
resp = {}
res, code = http.request({
url = url,
method = 'GET',
headers = {
authorization = 'Bearer ' .. token,
},
sink = ltn12.sink.table(resp),
})
resp = table.concat(resp)
resp = json.pdecode(resp)
--log(resp)
grp.checkwrite('1/1/1', resp.data.energy_out)
grp.checkwrite('1/1/2', resp.data.captar_actual)
grp.checkwrite('1/1/3', resp.data.meter)
grp.checkwrite('1/1/4', resp.data.power)
grp.checkwrite('1/1/5', resp.data.energy_in)
grp.checkwrite('1/1/6', resp.data.gas)
grp.checkwrite('1/1/7', resp.data.water)
grp.checkwrite('1/1/8', resp.data.captar_max)RE: Jullix - Danny - 12.02.2025 Tnx i gone try |