I have two CA8900 thermostats, which work great in that they respond as they should and I never really have to touch them; they’re also dirt cheap.
However, it’s getting to be that time of year in FL where the temperature actually fluctuates below core-of-the-Earth hot, and there being no “AUTO” function on the CA8900 is sort of an inconvenience. For those that don’t know, while the user can set both cool and heat setpoints, it still only “HEAT/COOL/OFF” settings, much like the older mechanical devices. I’m wondering if there isn’t some way to use logic to imitate the “AUTO” function of the more expensive thermostats. For example, using layman’s terms:
IF current room temp <= heat setpoint, set thermostat to HEAT
IF current room temp >= cool setpoint, set thermostat to COOL
Is there any reason this shouldn’t work? Is there someone that has already done this in Luup?
Put this code in Startup Lua. Add your thermostats’ device number in the THERMOSTATS array, separated by comma. (e.g. local THERMOSTATS = {14, 17, 19})
Try it and let me know if it works.
local THERMOSTATS = {14}
function updateThermostatStatus()
for _, deviceNo in pairs (THERMOSTATS) do
local heatSp = tonumber (luup.variable_get ("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat", "CurrentSetpoint", deviceNo), 10)
local coolSp = tonumber (luup.variable_get ("urn:upnp-org:serviceId:TemperatureSetpoint1_Cool", "CurrentSetpoint", deviceNo), 10)
local currentTemp = tonumber (luup.variable_get ("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", deviceNo), 10)
local modeState = luup.variable_get ("urn:micasaverde-com:serviceId:HVAC_OperatingState1", "ModeState", deviceNo) or "Idle"
if (modeState == "Idle") then
if (currentTemp) then
if (heatSp and currentTemp <= heatSp) then
luup.call_action ("urn:upnp-org:serviceId:HVAC_UserOperatingMode1", "SetModeTarget", {NewModeTarget = "HeatOn"}, deviceNo)
elseif (coolSp and currentTemp >= coolSp) then
luup.call_action ("urn:upnp-org:serviceId:HVAC_UserOperatingMode1", "SetModeTarget", {NewModeTarget = "CoolOn"}, deviceNo)
end
end
end
end
luup.call_delay ("updateThermostatStatus", 60, "")
end
updateThermostatStatus()
Thanks, done. I added my own device numbers in red above. I’m also using the Thermostat Min Max plugin, which I don’t expect should make any difference. I will try to test today.
Finally got around to testing this (starting to care because it’s getting below comfortable room temperatures in FL)… I have the code in my startup Luup, and when my t-stats are set to “COOL” and the heat setpoint is above the ambient temperature, the mode does not change. Thoughts?
This code works! Absolutely brilliant. I’m very pleased. The lack of the “AUTO” function on the CA8900 is the only real shortfall, IMO, and it’s no longer an issue. Outstanding!
I replaced 60 with 300. One of the thermostats is facing the kitchen, and during a movie last night the thermostat backlight was dimly reflecting off the vertical surfaces–just enough to tell something was going on.
Bug history says “Resolved, I added cycle mode in device definition” as of Nov 23rd 2011. And “Issue resolved in build 1.5.220. Bug closed.”
Just curious if there’s a way to get it on UI4 for my “production” Vera2.
Is there a way to use this code or achieve the same effect only “on demand,” instead of all the time. For example, can I run a scene that allows this code to go into effect when I go to sleep, and run a different scene to turn it off when I wake?
Best Home Automation shopping experience. Shop at Ezlo!