This project uses Flask for the backend, Bootstrap for the frontend, and Chart.JS for the data visualizations.
- Electronics-Salon Relay Board
- Lechacal RPICT3T1 Current and Temperature Sensor -- we are only using the temperature portion
- Raspberry Pi -- I used a 3B+ but other versions will likely work too.
-
Assemble the hardware however you like. I used standoffs to stack the three components, but you could use a breadboard as well.
-
Connect the thermostat wires to the relays as follows:
- Connect the
Rwire (either Rh or Rc) to theCterminal on relay 1 - Connect all the
Cterminals on all three relays together - Connect the
Wwire to theNOterminal on relay 1 (this controls the heat) - Connect the
Gwire to theNOterminal on relay 2 (this controls the fan) - Connect the
Ywire to theNOterminal on relay 3 (this controls the A/C)
- Connect the
-
Download and extract the source code to a folder of your choosing
-
Install
virtualenvandvirtualenvwrapper(skip to step 4 if you have these already).pip3 install virtualenv virtualenvwrapper
You will also need to make some changes to your
~/.bashrcfile for virtualenvwrapper to work properly, see here. -
Create a virtual environment for the project and switch into it
mkvirtualenv smarttthermostat workon smartthermostat
-
Install the Python dependencies
pip3 install -r requirements.txt
-
Open
static/settings.jsonand set your initial preferred temperature setpoint and tolerance, and indicate whether your home has heating and/or A/C by typingtrueorfalsewhere appropriate. Save the file. -
Launch the app
python3 main.py
-
Open the web interface to see your thermostat at work! By default, the web server runs on port 5000.