I installed two Intermatic CA8900 thermostats, and my biggest gripe about them was the lack of an “AUTO” mode; these thermostats have only “HEAT/COOL/OFF”. MCVflorin provided some code in this thread which, when placed in the Startup Lua tab, polls the current room temperature and compares to the HEAT & COOL setpoints, then sets the mode appropriately. If the current mode is COOL, if the room temperature drops below your current HEAT setpoint, Vera will change the thermostat state to HEAT.
Here is the code to deposit in your Startup Lua tab:
[code]local THERMOSTATS = {3,18}
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()[/code]
My device numbers are in there as 3 & 18; you need to change that to reflect your thermostat device numbers. Also, I changed the frequency of the poll by changing the luup.call_delay to 300 (5 minutes) rather than 60 (1 minute).