This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Jullix
#1
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!
Reply
#2
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)
Reply
#3
Tnx i gone try
Reply


Forum Jump: