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.
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 : (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)
Thanks.
(I’m still wondering about the return arguments of functions… there must be a way… )