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.

Data from http request - to JSON - to KNX
#5

Here is the solution, thank to you that know who you are. Wink

And thanks for all the help also! Smile

Code:
sock = require('socket').tcp()
sock:settimeout(5)

res, err = sock:connect('10.0.0.112', 80)
if res then
 sock:send('GET /output.json HTTP/1.1\r\n\r\n')
 res = sock:receive('*a')
 log(res)

 if res then
   p, e = res:find('\r\n\r\n', 1, true)
   if e then
     data = res:sub(e + 1)
     data = require('json').pdecode(data)
     log(data)
   end
 end
end

if data then
 CurrentSummationDelivered = data['0015BC001B024257'].CurrentSummationDelivered
 InstantaneousDemand = data['0015BC001B024257'].InstantaneousDemand
 grp.write('4/0/20', tonumber(CurrentSummationDelivered))
 grp.write('4/0/21', tonumber(InstantaneousDemand))
end
Reply


Messages In This Thread
RE: Data from http request - to JSON - to KNX - by Rune - 21.03.2018, 20:11

Forum Jump: