capture return arguments of an action

I’m trying to create an action in a plugin that returns arguments when called (http call).

I couldn’t find any documentation or hints on how to do what should be a very simple task!!
I managed to have the value returned by setting the relatedStateVariable as below, but I keep getting JobHandler_LuaUPnP::ConfirmReturnArguments missing Arg1 in the log.

<actionList> <action> <serviceId>urn:schemas-upnp-org:serviceId:ServiceX</serviceId> <name>ActionName</name> <run> luup.variable_set("urn:schemas-upnp-org:serviceId:ServiceX", "Arg1", Value1, lul_device) return true </run> </action> </actionList>

How can I get the return arguments without using these variables ?

The call_function Luup function has a return parameter called arguments.

The action Luup request also returns the result.

But how do you set these arguments in the action code in the implementation file ?

I tried to return them as a table but that didn’t work :

local lul_args = {}
lul_args.Arg1 = Value1

return true, “”, nil, lul_args[/code]

PS: I want to catch them in luup requests

Unfortunately it’s not possible to set the output arguments. I confirmed this with Aaron after I tried various methods. Sorry.

:o >:( :’(


If we can get the output arguments of a function, then there must be a way to set them!
I was able to do it using luup.variable_set (by chance) but was just checking if there was a more “official” method because I was getting the warnings in the log.

Calling a luup request to arm a motion sensor returns an XML (or json) file showing that the variable OK was set to OK somehow (I don’t have the implementation file of a sensor device to see how it’s done).

The only workaround that I discovered (quite by accident) is to use a registered Luup handler, and for the caller to make a second HTTP request (lr_handlerName) to get the value. I use it extensively in the Caddx alarm plugin; look at the L_* and J_* files. It works pretty well but the complexity is a turn-off.


I was trying to use actions thinking that return arguments would be easier to catch ::slight_smile: (as opposed to jobs).
Come to think of it, I guess I’ll use jobs and luup handlers instead, as you suggested (and avoid creating unnecessary variables and having blocks)


(I’m still wondering about the return arguments of functions… there must be a way… :frowning: )

Agreed 100%. If anyone figures it out, please share!