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
R
wire (either Rh or Rc) to theC
terminal on relay 1 - Connect all the
C
terminals on all three relays together - Connect the
W
wire to theNO
terminal on relay 1 (this controls the heat) - Connect the
G
wire to theNO
terminal on relay 2 (this controls the fan) - Connect the
Y
wire to theNO
terminal on relay 3 (this controls the A/C)
- Connect the
-
Download and extract the source code to a folder of your choosing
-
Install
virtualenv
andvirtualenvwrapper
(skip to step 4 if you have these already).pip3 install virtualenv virtualenvwrapper
You will also need to make some changes to your
~/.bashrc
file 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.json
and set your initial preferred temperature setpoint and tolerance, and indicate whether your home has heating and/or A/C by typingtrue
orfalse
where 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.