Thermostat status

Pop your questions regarding Home automation software here.....

Thermostat status

Postby erisan500 » Sun Dec 12, 2010 8:37 pm

How are you guys saving the thermostat status into the database? Right now I'm saving on/off change with respective date/time (thus 2 records, 1 for on, 1 for off).
Is there a better way to do this? I'm having some trouble graphing the on/off state over time.
Also, how do you calculate total on time by day if you have 2 records per state change?

Thanks in advance
Posts: 72
Joined: June 2009
Location: Belgium, Oppuurs

Re: Thermostat status

Postby Digit » Sun Dec 12, 2010 9:37 pm

In my case, Thermostat status is saved just as everything else. I don't have a custom "Thermostat" table.
The state of the thermostat (Off, Heating etc.) is a device value, provided by the thermostat API. Only changes are written to the table. So if there are 5 rows with value 3 (which means "Heating") in the table where I store all my historical data on a specific day, I know the thermostat switched to status "Heating" 5 times that day.

Total on time is a minute counter provided by the thermostat API. I store this counter value every hour; the starting value as well as ending value for that period (hour in this case). From there it's simple; if the row for 16:00 starts with 250 and ends with 300, it must have been on for 50 minutes. Sum that for all rows of a specific day and you've got what you want: on time per day.
User avatar
Global Moderator
Global Moderator
Posts: 3388
Joined: March 2006
Location: Netherlands

Return to Questions & Discussions Forum

Who is online

Users browsing this forum: No registered users and 1 guest