OK -
So I’m not new to programming LUUP, but I’m not an expert either. But this one has me pulling my hair out!
This following code works properly:
if (lowtemp > coldlow) then
return true
else
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,“HeatOn”,dID3)
local modestat = “HeatOn”
luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“SetModeTarget”,{NewModeTarget=modestat},dID5)
return true
end
But this code does not:
if (lowtemp > coldlow) then
return true
else
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,“HeatOn”,dID3)
local modestat = “HeatOn”
end
luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“SetModeTarget”,{NewModeTarget=modestat},dID5)
return true
Both routines should give the exact same results, but they don’t. In the first example, the variable container and the thermostat both change values - as they are supposed to. But in the second example, only the variable container changes values; the thermostat does not. It’s as if the routine quits when it finishes the if-then-else condition, but it shouldn’t. It should go to the next statement.
Any ideas? What am I missing?
Melsman