Table-driven programmability of 2gig CT100 thermostats

I have a 2gig CT100 that I was sad to see wasn’t easily programmable anymore when I switched to the Vera Lite.

So I hacked up a simple table-driven scheduler. It sets both heating and cooling temps, but not the mode. So you can set it up for summer and winter and switch just by pressing the mode button on the thermostat itself.

To configure it, set thermostatDeviceNumber to match your thermostat, and then configure the temperatures with as many rows in the heating and cooling tables you’d like. Each row has a temp for each day of the week, and a start time (in seconds since midnight). The end time for any given period is the start of the next period, or midnight.

To use it, create a scene that triggers every few minutes, and paste in the following LUA:

[code]local temps_Heat = { {65, 65, 65, 65, 65, 65, 65, startTime=3600}, – 1:00AM
{67, 68, 68, 68, 68, 68, 68, startTime=27000}, – 7:30AM
{68, 65, 65, 65, 65, 65, 68, startTime=32400}, – 9:00AM
{68, 65, 65, 65, 65, 65, 68, startTime=46800}, – 1:00PM
{68, 68, 68, 68, 68, 68, 68, startTime=59400}, – 4:30PM
{67, 67, 67, 67, 67, 67, 67, startTime=82800} – 11:00PM
}

local temps_Cool = { {74, 74, 74, 74, 74, 74, 74, startTime=3600}, – 1:00AM
{71, 71, 71, 71, 71, 71, 71, startTime=27000}, – 7:30AM
{71, 78, 78, 78, 78, 78, 71, startTime=32400}, – 9:00AM
{71, 78, 78, 78, 78, 78, 71, startTime=46800}, – 1:00PM
{71, 71, 71, 71, 71, 71, 71, startTime=59400}, – 4:30PM
{74, 74, 74, 74, 74, 74, 74, startTime=82800} – 11:00PM
}
local thermostatDeviceNumber = 18

local t = os.date(‘*t’)
local current_second = t.hour * 3600 + t.min * 60 + t.sec
local current_day = t.wday

function applyTemp( serviceId, tempsTable )

for i,temps in ipairs(tempsTable) do
local startTime = temps.startTime
local endTime = current_second + (3600 * 24)

if (tempsTable[i+1]) then
  endTime = tempsTable[i+1].startTime
end

if (endTime > current_second) then
  if (startTime <= current_second) then
    luup.log("Settint " .. serviceId .. " temp to " .. temps[current_day])
    luup.call_action(serviceId, "SetCurrentSetpoint", {NewCurrentSetpoint = temps[current_day]}, thermostatDeviceNumber)
  end
end

end
end

applyTemp( “urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”, temps_Heat )
applyTemp( “urn:upnp-org:serviceId:TemperatureSetpoint1_Cool”, temps_Cool )

return true[/code]

Thanks for posting this!

I’m having trouble getting this to work. I found the Device ID by clicking on “Devices”, then the wrench on the thermostat device, then the “Settings” tab, and looking at the ID row.
[url=https://www.evernote.com/shard/s1/sh/14692cfb-f348-4457-bb80-239230209f68/ac2938a4cca115654da5e4972c4c946d]https://www.evernote.com/shard/s1/sh/14692cfb-f348-4457-bb80-239230209f68/ac2938a4cca115654da5e4972c4c946d[/url]

I created a new scene with no devices, clicked on the LUUP tab and pasted the code, then saved everything.
[url=https://www.evernote.com/shard/s1/sh/b6f68119-1a79-45e1-a7d1-769eccc53de3/c9384d957e224dc3ac9b8b3a75ad68c8]https://www.evernote.com/shard/s1/sh/b6f68119-1a79-45e1-a7d1-769eccc53de3/c9384d957e224dc3ac9b8b3a75ad68c8[/url]

I used your default code just to see how it would work, but nothing happens.

Any thoughts on how to start troubleshooting this?

Thanks,
Zak

Sorry for taking so long to reply.

Given your screenshot, your device number is 3, not 2.

The device number isn’t in the “ID” row, it’s the number up at the top of the page after “Device #”. The lovely UI5 makes this about as clear as mud.

I made that same mistake initially, and it took me a half a day and a lot of verbose logging to figure out why it wasn’t working. :slight_smile:

jbaboval, wow thank you so much for this.

in case you see this I had a couple of questions.

The days of the week begin with which day? sunday? Monday?

Also, just to confirm, you mention set a trigger, but actually it is a schedule right? Set to run every some minutes, say 10?

Thanks again for sharing this, I think it is exactly what I was looking for.

Great WORK!!!

I am really hoping to revive this topic.

I was able to use my CT100 thermostat’s for the winter, and now its spring/summer and I just realized all of my programming does not change when I hit the “mode” button.

Basically, everything I program within Vera Lite to either “heat” or “cool” does not matter because one overrides the other… leaving only one possible setting.

I used the LUUP created in this thread, havent found anything else anywhere.

Does anyone have any idea how to make the veralite operate the CT100 with both a heat and a cool setting that does not override one another???

I’m successfully using the table in combination with the Smart Virtual Thermostat Plug in. The Smart Virtual Thermostat however has the option to set two temp. levels - ECO and COMFORT. Hence, I’m wondering whether I could use the script by simply replacing the table temp. settings with “EnergySavingsMode” and “Normal” respectively.

The modifications I enviaged are:
luup.call_action(serviceId, “SetEnergyModeTarget”, {NewEnergyModeTarget = temps[current_day]}, thermostatDeviceNumber)

and

applyTemp( “urn:urn:upnp-org:serviceId:HVAC_UserOperatingMode1”, temps_Heat )

However, sofar I’m running into LUA error message on which I can’t lay my hands on the cause of it.
Any thoughts would be appreciated.