it works but if ur using a motion sensor tripp time i found that just using “tripped” state works petter that usinf the os.difftime() calculation with last tripped, what i was doing was motion detection on lights
[code]function checkLastTrip()
local lastTripmotion = luup.variable_get (SS_SID, “LastTrip”, KitchenMotion) --or os.time()
local Tripstate = luup.variable_get (SS_SID, “Tripped”, KitchenMotion)
local Ostime = os.time()
local osdifftime = os.difftime (tonumber (os.time()), tonumber (lastTripmotion))
luup.log("Os Time = " … Ostime … ", LastTrip = " … lastTripmotion … ", Diff = " … osdifftime … ", Trip state = " … Tripstate … “.”)
if (Tripstate == “0”) then
–(tonumber (os.difftime (tonumber (os.time()), tonumber (lastTripmotion))) >= tonumber (period))
luup.log("run Scene to dimm lights")
luup.call_action(PH_SID, "RunHueScene", {hueSceneID= Kitchendimall }, BurnsedPl) -- Brighten Scene
luup.log("Re-dimm the light Scene")
luup.call_action(SD_SID, "SetLoadLevelTarget", {newLoadlevelTarget= tonumber (Dimmlvl)}, HueKitchen1) -- Re-dimm the light.
luup.log("Re-dimm the light.")
luup.call_action(SD_SID, "SetLoadLevelTarget", {newLoadlevelTarget= tonumber (Dimmlvl)}, HueKitchen1) -- Re-dimm the light.
luup.log("Re-dimm the light.")
luup.call_action(SD_SID, "SetLoadLevelTarget", {newLoadlevelTarget= tonumber (Dimmlvl)}, HueKitchen2) -- Re-dimm the light.
luup.log("Re-dimm the light.")
luup.call_action(SD_SID, "SetLoadLevelTarget", {newLoadlevelTarget= tonumber (Dimmlvl)}, HueKitchen3) -- Re-dimm the light.
luup.log("Re-dimm the light.")
luup.call_action(SD_SID, "SetLoadLevelTarget", {newLoadlevelTarget= tonumber (Dimmlvl)}, HueKitchen4) -- Re-dimm the light.
else
luup.call_delay ("checkLastTrip", period) -- Check when the sensor was last tripped every <period> seconds.
end
end
luup.call_delay (“checkLastTrip”, period)
return true
[/code]
i isued that instead and changed my motion sensor timeout to 1 min