I am working on some code to abort a scene if not between certain times without using a virtual device. I am having problems if I run it more than once. If the first run returns false, the next runs will return false even if the conditions evaluate to true. If I restart luup in between, the second run executes correctly. If the first run does not return false, then the second will execute correctly. Anyone know of a reason this might be happening? Here is my code with logs coming shortly.
do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not <b") return false
end
end
Here are the logs.
10 10/18/10 12:31:38.224 UPnPCallbackEventHandler action RunLua request pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
10 10/18/10 12:31:38.224 sbrk JobHandler_LuaUPnP::HandleActionRequest from IP:127.0.0.1 pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
08 10/18/10 12:31:38.225 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x2c0c>
08 10/18/10 12:31:38.226 JobHandler_LuaUPnP::HandleActionRequest argument Code=do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
20 10/18/10 12:31:38.228 LuaInterface::StartEngine 0x786ab0 device 0 <0x2c0c>
50 10/18/10 12:31:38.230 luup_log:0: 31 <0x2c0c>
50 10/18/10 12:31:38.231 luup_log:0: a is not
01 10/18/10 12:31:38.231 LuaInterface::StartEngine returned false: 0 <0x2c0c>
01 10/18/10 12:31:38.232 JobHandler_LuaUPnP::RunLua failed: do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
10 10/18/10 12:31:38.233 UPnPCallbackEventHandler action RunLua request done pMem 0x7be000/8118272 diff: 872448 took 0 <0x2c0c>
No restart between runs, I just let time advance until conditions would be true.
10 10/18/10 12:36:43.873 UPnPCallbackEventHandler action RunLua request pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
10 10/18/10 12:36:43.874 sbrk JobHandler_LuaUPnP::HandleActionRequest from IP:127.0.0.1 pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
08 10/18/10 12:36:43.875 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x2c0c>
08 10/18/10 12:36:43.875 JobHandler_LuaUPnP::HandleActionRequest argument Code=do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
20 10/18/10 12:36:43.877 LuaInterface::StartEngine 0x786ab0 device 0 <0x2c0c>
50 10/18/10 12:36:43.878 luup_log:0: 36 <0x2c0c>
50 10/18/10 12:36:43.879 luup_log:0: Yes <0x2c0c>
01 10/18/10 12:36:43.880 LuaInterface::StartEngine returned false: 0 <0x2c0c>
01 10/18/10 12:36:43.880 JobHandler_LuaUPnP::RunLua failed: do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
10 10/18/10 12:36:43.881 UPnPCallbackEventHandler action RunLua request done pMem 0x7be000/8118272 diff: 872448 took 0 <0x2c0c>
Then I restarted luup by saving and ran it again
10 10/18/10 12:38:44.996 UPnPCallbackEventHandler action RunLua request pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
10 10/18/10 12:38:44.996 sbrk JobHandler_LuaUPnP::HandleActionRequest from IP:127.0.0.1 pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
08 10/18/10 12:38:44.997 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x2c0c>
08 10/18/10 12:38:44.998 JobHandler_LuaUPnP::HandleActionRequest argument Code=do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
20 10/18/10 12:38:45.000 LuaInterface::StartEngine 0x786ab0 device 0 <0x2c0c>
50 10/18/10 12:38:45.002 luup_log:0: 38 <0x2c0c>
50 10/18/10 12:38:45.003 luup_log:0: Yes <0x2c0c>
10 10/18/10 12:38:45.004 UPnPCallbackEventHandler action RunLua request done pMem 0x7be000/8118272 diff: 872448 took 0 <0x2c0c>
Then I let time advance until conditions would return false.
10 10/18/10 12:51:12.521 UPnPCallbackEventHandler action RunLua request pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
10 10/18/10 12:51:12.521 sbrk JobHandler_LuaUPnP::HandleActionRequest from IP:127.0.0.1 pMem 0x7be000/8118272 diff: 872448 <0x2c0c>
08 10/18/10 12:51:12.522 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x2c0c>
08 10/18/10 12:51:12.523 JobHandler_LuaUPnP::HandleActionRequest argument Code=do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
20 10/18/10 12:51:12.525 LuaInterface::StartEngine 0x786ab0 device 0 <0x2c0c>
50 10/18/10 12:51:12.526 luup_log:0: 51 <0x2c0c>
50 10/18/10 12:51:12.527 luup_log:0: b is not < c <0x2c0c>
01 10/18/10 12:51:12.527 LuaInterface::StartEngine returned false: 0 <0x2c0c>
01 10/18/10 12:51:12.528 JobHandler_LuaUPnP::RunLua failed: do
local a=35
local b=os.date("*t").min
local c=50
luup.log(b)
if (a<b) then
if(b<c) then
luup.log("Yes")
else luup.log("b is not < c") return false
end
else luup.log("a is not
10 10/18/10 12:51:12.529 UPnPCallbackEventHandler action RunLua request done pMem 0x7be000/8118272 diff: 872448 took 0 <0x2c0c>
I have no idea why this is happening. If anyone can shed some light on it for me I would appreciate it.