I have no idea why I am having such a hard time with these, but I am. I have been able to successfully CONTROL all of these devices with luup, but only on a few of them can I actually get a variable returned to me. I have created a function to make it easier to remember without looking up the correct syntax everytime, but I need someone to take a look and see if they can spot my problem. I am one million percent positive that I have the device id’s correct, so I know that isn’t it.
Here is my function. I have commented to the right hand side which ones are not working for me. (pretty much all of them).
[code] function device_var(deviceID, pVar)
if (pVar == "dimmer") then
local lul_status=luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget",deviceID)
return tonumber(lul_status)
elseif (pVar == "switch" or "plug" or "fan") then
local lul_status=luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status",deviceID)
return tonumber(lul_status)
elseif (pVar == "weather") then
local lul_status = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Condition",deviceID) -- not working
return lul_status
elseif (pVar == "weather-temperature") then
local lul_status = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","CurrentTemperature",deviceID) -- not working
return tonumber(lul_status)
elseif (pVar == "therm-cool") then
local lul_status = luup.variable_get("urn:upnp-org:serviceId:TemperatureSetpoint1_Cool","CurrentSetpoint",deviceID) -- not working
return tonumber(lul_status)
elseif (pVar == "therm-heat") then
local lul_status=luup.variable_get("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat","CurrentSetpoint",deviceID) -- not working
return tonumber(lul_status)
elseif (pVar == "therm-mode") then
local lul_status=luup.variable_get("urn:upnp-org:serviceId:HVAC_UserOperatingMode1","ModeStatus",deviceID) -- not working
return lul_status
elseif (pVar == "therm-temperature") then
local lul_status=luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", deviceID) -- not working
return tonumber(lul_status)
elseif (pVar == "lock") then
local lul_status= luup.variable_get ("urn:micasaverde-com:serviceId:SecuritySensor1", "Armed", deviceID) -- Only works for locked status (1)
return tonumber(lul_status)
elseif (pVar == "sensor") then
local lul_status= luup.variable_get ("urn:micasaverde-com:serviceId:SecuritySensor1", "Armed", deviceID) -- not working
return tonumber(lul_status)
elseif (pVar == "sensor-tripped") then
local lul_status= luup.variable_get ("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceID) -- not working
return tonumber(lul_status)
end
end
[/code]
And here is a sample of the code I am using to check a variable:
if (device_var(50,"lock") ==0) then
end
Any pointers would be greatly appreciated!