29.01.2024, 12:54
Try this:
Code:
res, code = require('socket.http').request({
url = 'https://horsensvej.rokum.ro/api/v1/entries?token=https%3A%2F%2Fhorsensvej.rokum.ro%2F%3Ftoken%3Dknx-2e4b5b25355f26bb',
method = 'GET',
})
if not res then
log('request failed', code)
return
end
lines = res:split('\n')
items = lines[ 1 ]:trim():split('\t')
for i, item in ipairs(items) do
items[ i ] = item:gsub('^"(.*)"$', '%1')
end
grp.checkupdate('1/1/1', items[ 1 ])
grp.checkupdate('1/1/2', items[ 2 ])
grp.checkupdate('1/1/3', items[ 3 ])
grp.checkupdate('1/1/4', items[ 4 ])
grp.checkupdate('1/1/5', items[ 5 ])