Thermostat status

Pop your questions regarding Home automation software here.....
Post Reply
erisan500
Member
Member
Posts: 72
Joined: Thu Jun 18, 2009 10:20 pm
Location: Belgium, Oppuurs
Contact:

Thermostat status

Post by erisan500 »

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
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Thermostat status

Post by Digit »

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.
Post Reply

Return to “Questions & Discussions Forum”