{SOLVED} How read the values from luup.call_action

I am looking to read the value, specifically the returnArguments from the luup.call_action. It comes back as table or list and I can not figure out how to loop thru to get each value. Below is sample code:

[code]local ALTUI_DEVICE_NO = 850
local ALTUI_DEVICE_SID = “urn:upnp-org:serviceId:altui1”
local GROUP_ID_KITCHEN = “RINCON_B832343333301400:4353”

resultCode, resultString, job, returnArguments = luup.call_action(ALTSONOS_DEVICE_SID, “GetVolume”, { groupID = GROUP_ID_KITCHEN} , ALTSONOS_DEVICE_NO)
[/code]

Return arguments are in a table with name/value pairs.

You can loop through these:

for name,value in pairs (returnArguments) do
  -- whatever you like
end

or simple access each value by name:

if returnArguments.whatever then ...

Be aware, though, that if ithe action is implemented as a job, the call may well return before the job is run.

[quote=“kyle.dawson, post:1, topic:200291”]I am looking to read the value, specifically the returnArguments from the luup.call_action. It comes back as table or list and I can not figure out how to loop thru to get each value. Below is sample code:

[code]local ALTUI_DEVICE_NO = 850
local ALTUI_DEVICE_SID = “urn:upnp-org:serviceId:altui1”
local GROUP_ID_KITCHEN = “RINCON_B8E93758FA4001400:725”
local GROUP_ID_FAMILY_ROOM = “RINCON_000E58C7D93A01400:4198103609”

resultCode, resultString, job, returnArguments = luup.call_action(ALTSONOS_DEVICE_SID, “GetVolume”, { groupID = GROUP_ID_KITCHEN} , ALTSONOS_DEVICE_NO)
[/code][/quote]

for key,val in pairs(returnArguments ) do

No matter what I try the value is nil.

local ALTUI_DEVICE_NO = 850 local ALTUI_DEVICE_SID = "urn:upnp-org:serviceId:altui1" local GROUP_ID_KITCHEN = "RINCON_A8E956A3758FA4" resultCode, resultString, job, returnArguments = luup.call_action(ALTSONOS_DEVICE_SID, "GetVolume", { groupID = GROUP_ID_KITCHEN} , ALTSONOS_DEVICE_NO) local name, value for name,value in pairs(returnArguments) do luup.log("Debug Name: " .. name) luup.log("Debug Value: " .. value) end

I get this result

[string “ALTUI - LuaRunHandler”]:6: bad argument #1 to ‘pairs’ (table expected, got nil)

Check the status return from the call… it must be failing.

Are you sure that you are using the correct serviceId and parameter names?

Well that is a dumb user error. I was testing ALTUI and ALTSONS and mixed up the numbers. Thanks so much, its working great now.