I am writing Luup code to make changes to thermostat set point based off of outside air temp as recorded using the Wunderground World Weather app.
Having spent hours debugging can anyone help?
local lul_temp = luup.variable_get(“urn:schemas-upnp-org:device:HVAC_ZoneThermostat:1”,“CurrentTemperature”, 8)
if (tonumber(lul_temp) > 26.6) then
return true
end
[quote=“rjrabe87, post:1, topic:184212”]I am writing Luup code to make changes to thermostat set point based off of outside air temp as recorded using the Wunderground World Weather app.
Having spent hours debugging can anyone help?
local lul_temp = luup.variable_get(“urn:schemas-upnp-org:device:HVAC_ZoneThermostat:1”,“CurrentTemperature”, 8)
if (tonumber(lul_temp) > 26.6) then
return true
end
thanks[/quote]
You don’t want to be using the device type [tt]urn:schemas-upnp-org:device:HVAC_ZoneThermostat:1[/tt] in the[tt] luup.variable_get[/tt] call, you instead want to use the service ID [tt]urn:upnp-org:serviceId:TemperatureSensor1[/tt].
[tt]tonumber()[/tt] is a Lua built-in function that tries to convert an expression to a number, as in this case where it is passed a string (or [tt]nil[/tt]). If the string meets the format of a string, [tt]tonumber()[/tt] converts it to a number so you can use numeric comparison operators. See http://www.lua.org/manual/5.1/manual.html.
Best Home Automation shopping experience. Shop at Ezlo!