i have a really strange problem. I dont know if im right in LUA or Blocky board, but lets start. I have the following LUA script, that gets me data every minute from a REST:
Code: Select all
commandArray = {}
now=os.date("*t")
-- NB : every 5 minutes only, if u prefer every 2 min or even every 1 min
-- change the 5 below
if now.min % 1 == 0 then
local stringVorlauf = assert(io.popen("curl -s http://10.168.2.60:8088/rest/devices/Vorlauf/attributes/Temp/value" , 'r'))
local vorlauf = stringVorlauf:read('*all')
local stringKollektor = assert(io.popen("curl -s http://10.168.2.60:8088/rest/devices/Kollektor/attributes/Temp/value" , 'r'))
local kollektor = stringKollektor:read('*all')
print("Pool Wasser: "..vorlauf)
print("Pool Kollektor: "..kollektor)
commandArray[1] = {['UpdateDevice'] = 18 .. '|0|' .. vorlauf}
commandArray[2] = {['UpdateDevice'] = 19 .. '|0|' .. kollektor}
end
return commandArray
Code: Select all
2017-10-19 11:16:53.346 EventSystem: Script event triggered: Pool2
2017-10-19 11:16:55.108 LUA: Pool Wasser: 10.5
2017-10-19 11:16:55.108 LUA: Pool Kollektor: 10.5