View on GitHub

hvac

Collect and graph data from thermostat

HVAC Thermostat data graph

This is a php-based code that provides a web-interface to graph data collected from thermostat. This works for “Radio Thermostat CT80”, I don’t see why it wouldn’t work for any other unit. As long as the thermostat provides a RESTful API, the collection scripts can be tailored to fit your own. The workflow is simple, you provide the IP address or hostname of you thermostat. RESTful API calls executed by means of a cron job on the host server to read from the Thermostat, the collected data is stored in a local SQLite database. The graph uses Chart.js to display the collected data read from the database.

You may choose to host the code on your own webserver without Docker. Simply copy the content of hvac/web/src/ and ignore the rest.

Pre-requisites

Installation

  1. Clone this:

     git clone https://github.com/adlytaibi/hvac
    
     cd hvac
    
  2. SSL certificates

     mkdir web/sslkeys
    
    1. Self-sign your own certificates: (modify web to match your server)

       openssl req -x509 -nodes -newkey rsa:4096 -keyout web/sslkeys/host.key -out web/sslkeys/host.pem -days 365 -subj "/C=CA/ST=Ontario/L=Ottawa/O=Home/OU=Automation/CN=web"
      
  3. docker-compose

     docker-compose up -d
    
  4. The login page can be accessed using the URL below:

     https://<IP_address>
    

    (or if accessing from the same guest https://localhost)

    Needed PHP modules are checked as well as ability to write to the database directory.

  5. If you’re ready to connect to your Thermostat, enter the hostname or IP address:

  6. Or you can try out the application with randomly generated data in a demonstration mode:

  7. Data points will be generated for the number of months selected. The time to process depends on how powerful your server is.

  8. Monthly view averages are calculated for inside/outside temperatures and humidity

  9. Selecting a month will take you to a Weekly view with average values per week

  10. Selecting a week will take you to a Daily view with average values for per day

  11. Selecting a day will take you to an Hourly view which represents raw values as they were collected as well as showing the heating/cooling runtime of the HVAC system

  12. At any time you can jump to Today's view with the home button. You can quickly jump to next/previous days

  13. Finally, the demonstration data can be deleted when you’re done staring at it. This will bring you back to the setup view as in (5).

  14. Cron file is conveniently provided here hvac/web/cron/hvac to run from the Docker host. Drop the Docker section of the command if you’re running without Docker.

Further reading

Notes