Just getting my feet wet with luup coding. I am trying to create a simple scene that will announce the station playing on my Sonos speaker. Can someone help me with the following code? I keep getting a return value of nil for varCurrentRadio. What am I missing.
[hr]
local SonosConnectDeviceID = 15
local Sonos_SID = “urn:micasaverde-com:serviceId:Sonos1”
local Sonos_DeviceID = “urn:upnp-org:serviceId:DeviceProperties”
local varCurrentRadio = luup.variable_get(Sonos_DeviceID ,“CurrentRadio”,
SonosConnectDeviceID)
if (varCurrentRadio == nil) then
luup.call_action(Sonos_SID, “Say”,
{Text=“I’m not sure.”, Language=“en”, Volume=15},
SonosConnectDeviceID)
else
luup.call_action(Sonos_SID, “Say”,
{Text=varCurrentRadio, Language=“en”, Volume=15},
SonosConnectDeviceID)
end