I am working on my own version of the “random lights while I am out” scene and am having a problem with luup.call_delay. I have tried the following in the luup test code box (device=0) and get an apparent success, but execution is not logged. I used the following
Once I got the syntax correct, “fail” went from “-1” to 0, which I believe indicates success. However the “test delay success” never shows up in the log. I would appreciate anyone pointing out the obvious.
the first parameter to luup.call_delay() is the name of a Lua function to call after the delay.
but “luup.log” isn’t the name of the luup.log function! in Lua, luup.log means: _G["luup"]["log"], what you’re telling luup.call_delay() is to call _G["luup.log"] see the difference?
the ‘easy’ solution is to add a trivial function:
function mylog(s)
luup.log(s)
end
and call luup.call_delay(“mylog”, 1, “test delay success”)
another (cleaner) solution is to just provide a global name for luup.log:
Yes. If you want to pass a table you can either use a function to serialize the table in a string and deserialize it in the called function, or use a global variable.
Best Home Automation shopping experience. Shop at Ezlo!