Red River Thermostat 2.0

I’ve made enough changes to the thermostat project that I figured it was worth an update. Firstly, I changed the way the web interface interacts with the thermostat daemon. Previously the web interface was hosted on a http server that was built into the webiopi package. This worked ok but it limited things like php scripting and methods for connecting to the database. Now, all of the web stuff is hosted on a separate lighthttpd daemon and it fetches information about the sensors and the state of the thermostat via a socket to the running thermostat daemon. PHP scripts on the http server take care of connecting to either the daemon or the mysql database and pass information to the javascript in a sensible way which makes things…….simpler(?)  It’s easier for me to know what’s going on anyhow, and it’s forcing me to learn alot more about javascript, PHP, and web app development

With the more capable http server I was able to incorporate some more interesting visualizations for the temperature display (gauges came from here).

Screenshot from 2016-04-23 07:05:11


The reasoning behind creating the socket based communications with the thermostat was that it would make creating new control applications simpler. In the long run I might make an android app that’ll be a bit snappier than the web interface. A kodi plugin is another possibility, to allow me to see/change the thermostat from our media pc. Both of these are made easier by having a socket based connection that spits out easy JSON blobs for processing. Here’s an example of what comes from a request for sensor parameters:

{ “Living Room”: { “humidity”: 0, “i2c_address”: “0x77”, “pressure”: 97281.0, “read_successful”: true, “temperature”: 29.4544021645641, “type”: “bmp”, “webiopi_name”: “bmp0” } },
{ “Bedroom”: { “humidity”: 0, “ip”: “”, “pressure”: 0, “read_successful”: true, “temperature”: 29.46, “type”: “tmp”, “webiopi_name”: “bmp0” } },
“webiopi”: 1 }

Here’s an example page showing environmental data for the past few days. The outdoor temp looks a little crazy because the sensor catches some sun in the middle of the day. You can see the inclusion of the Time v Gases in the bottom right graph, that’s data being logged from the gas sensor board, which turns out is pretty boring. I guess that’s a good thing though…


Below is a run time graph for the equipment being controlled. Should give an idea of my energy consumption once the database get’s more filled out.


The next thing I’m planning to add is an electricity monitoring page. I ordered some cheap clip on current transformers that I can stick in the panel to read current draw, they can be used to log  our power consumption to the same db, and hopefully can be used to work towards getting our outrageous hydro bills down…

Code is up as always at






Tags: , , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: