commandArray = {}
if otherdevices['test2']~=otherdevices['test1'] then
if uservariables['status1']==1 then
otherdevices_lastupdate['test1'] = os.date("%Y-%m-%d %H:%M:%S")
commandArray['Variable:status1'] = tostring(0)
else
t2 = os.time()
s = otherdevices_lastupdate['test1']
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)
t1 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t2, t1))
if difference>15 then
commandArray['test1'] = otherdevices['test2']
commandArray['Variable:status1'] = tostring(1)
end
end
end
return commandArray
if otherdevices['test2']~=otherdevices['test1'] then
if uservariables['status1']==1 then
otherdevices_lastupdate['test1'] = os.date("%Y-%m-%d %H:%M:%S")
commandArray['Variable:status1'] = tostring(0)
else
t2 = os.time()
s = otherdevices_lastupdate['test1']
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)
t1 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t2, t1))
if difference>15 then
commandArray['test1'] = otherdevices['test2']
commandArray['Variable:status1'] = tostring(1)
end
end
end
return commandArray
Комментариев нет:
Отправить комментарий