I've tried using this one: viewtopic.php?t=13782
but I can't get the code working properly
Currently using: Version: 4.10022
Here is what I got
Code: Select all
-- Device Last Updates
t1 = os.time()
devices = {
"Remotec 1",
"Remotec 2",
"Remotec 3",
"Remotec 4",
"Computer",
"Computerhok Printer",
"Computerhok Licht 1",
"Computerhok Licht 2""
}
for i = 1, #devices do
s = otherdevices_lastupdate[devices[i]]
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}
str = (devices[i] .. "LastUpdate")
str = str:gsub("%s+", "")
str = string.gsub(str, "%s+", "")
_G[str] = (os.difftime (t1, t2))
end
commandArray = {}
-- Curtain button
if (devicechanged['Remotec 1'] == 'On' and otherdevices['Computer'] == 'Closed' and Remotec 1LastUpdate > 2) then
commandArray['Computer'] = 'On'
end
return commandArray