LUA - lastupdate, getting wrong data[solved]
Posted: Friday 27 May 2016 22:40
MySensors, EthernetGateway, 1.5.1
DZ running on Windows 7 as Service, 3.4967
I have 8 Temp/Hum nodes.
Below is my LUA script, I have very low knowledge of LUA.
My problem is that Node KoketFonster is not getting the lastest lastupdate time, it gets second last. For all other nodes I get correct lastupdate time.
I send data every 30 mins from each node.
I have check if one of the data that is send is old but it is not, all 3 data that I send is on same time. I send Temp, Hum and Volt. Only difference is that KoketFonstret is not the same type of sensor as the rest of my nodes.
If I run is says the latest time, so I dont understand where the second last time is coming from, the time is correct but not the latest.
Anyone that have an idea why I is like this?
DZ running on Windows 7 as Service, 3.4967
I have 8 Temp/Hum nodes.
Below is my LUA script, I have very low knowledge of LUA.
My problem is that Node KoketFonster is not getting the lastest lastupdate time, it gets second last. For all other nodes I get correct lastupdate time.
I send data every 30 mins from each node.
I have check if one of the data that is send is old but it is not, all 3 data that I send is on same time. I send Temp, Hum and Volt. Only difference is that KoketFonstret is not the same type of sensor as the rest of my nodes.
If I run
Code: Select all
http://192.168.100.18:8080/json.htm?type=devices&rid=92
Anyone that have an idea why I is like this?
Code: Select all
commandArray = {}
local function update(cmd)
vari = "Variable:" .. cmd
t1 = os.time()
s = otherdevices_lastupdate[cmd]
print(s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
if (difference > 2400) and (uservariables[cmd] == 0) then
commandArray['SendEmail']=''..cmd..' mer än 40 min# #[email protected]'
print ("ingen data på 40 min " .. cmd)
commandArray[vari] = "1"
elseif (difference < 2400) and (uservariables[cmd] == 1) then
commandArray[vari] = "0"
end
end
update ('Ute')
update ('KoketFonster')
update ('Uterummet')
update ('BadrumUppe')
update ('VinglasSkapet')
update ('Sovrum')
update ('TempHumandi')
update ('TempHumtst')
return commandArray