Luup Sample Code

Greetings,

I’m trying to turn on my dimmable light, ID 7, using the sample provided in the wiki in the ‘Test Luup code (Lua)’ screen. I press Go and get ‘Received empty response’ and the light does not turn on.

The code is:
lu_CallAction(“urn:upnp-org:serviceId:Dimming1”,“SetLoadLevelTarget”,{ newLoadlevelTarget=“30” },7)

which is straight from the wiki, only changing the 6 to 7.

What am I missing?

Thanks,
Brian

I’m not a coder, but a quick search in the wiki revealed a possible suggestion:

Try luup.call_action instead.

Examine this Luup snippet:

local lul_arguments = {}

lul_arguments[“newTargetValue”]=“0”

lul_resultcode,lul_resultstring,lul_job,lul_returnarguments = [b]luup.call_action/b

This may be an indicator that MCV re-wrote (or normalized) portions of the Luup API, a discussion I recall seeing elsewhere in the Forum.

Hope this helps, though I’m clearly grasping at straws. :wink:

Brian,
Can you provide the hyperlink to the wiki.micasaverde.com page containing the incorrect sample? This will help folks to get it corrected to the newer syntax.

The “mapping” is on post #6 of this thread:

http://forum.micasaverde.com/index.php?topic=1561.0

If you see an example of the form lug_xxxxx or lu_xxxxx then it’s an older style example that needs to be converted.

One example I ran across, where the “older style” code is mentioned…

http://wiki.micasaverde.com/index.php/Luup_Scenes_Events
(See section 3.1 “Misc actions”)

To find this example, I “cheated” the wiki’s search utility by looking for “upnp-org:serviceId” and examining each instance it found. (Search is not terribly adept at finding instances of “lu_callAction” for some reason.)

Would you mind being the one to edit the wiki in this case? I might screw something up, since I don’t understand Lua/Luup at all. :-\

done, just applied the literal string translation. I’ve assumed these calls are still the same in terms of parameters etc, since I dont use Luup scene code… yet.

Outstanding. Looks like you updated the wiki. Using that new sample code, I was able to dim my dining room light.

The wiki I was using was the LUUP Scenes Events.

Thanks,