Job Returns

Hopefully someone can help me with this. I have created a plugin that communicates with an Autelis pool control device. However, I am having some issue with job declarations and their return values. It all works but I end up with an error in the log as below.

In my I_ device file I have the following code.

urn:rstrouse-com:serviceId:PentairIntellibrite1
SetColorMode

luup.log("Setting Color Mode for: " … luup.devices[lul_device].id … " to " … lul_settings.newColorMode)
atp_plugin.jobSetColorMode(lul_device, lul_settings)
return 5, nil

Which calls the function jobSetColorMode in my .lua file. Everything works famously. The function is called and the function sends out the proper commands. Yet I still end up with the error in the logs. I have tried to return false, true, 0, 1 and any other iteration I could think of. This function sends a command to the Autelis device using wget then moves on.

Frankly, I am at a loss. I know that I somehow need to tell the job queue that I am finished but I don’t know how to go about it. Even though I have searched and searched the forums as well as the quote unquote online docs. Is there some sort of event model related to the incoming tags. I am not using serial communication, I am assembling the command structure for the Autelis device then calling wget.

Thanks in advance, any help would be appreciated.

Sorry, it didn’t pick up my attachment.

The correct return when a Job has completed is:

return 4,nil

See [url=http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand#.3Crun.2Fjob.2Fincoming.2Ftimeout.3E]http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand#.3Crun.2Fjob.2Fincoming.2Ftimeout.3E[/url] for details.

Thanks Rex. Funny I was trying to figure out how to implement a callback. Looks like the incoming block is primarily just for buffering I/O. Duh :o

The wiki documentation is not really clear and suggests that the tag will make a new thread for you (asynchronously).

It’s not that. Your code will be called another time if you return a waiting time.

So, the job can not really take as long as you want (the code called each time has to be fast too).