No description, website, or topics provided.
Python JavaScript HTML Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


DIY thermo solution center component


First, create a python3 virtualenv

$ VENV=~/.venv
$ virtualenv -p /usr/bin/python3 $VENV

Activate it

$ . $VENV/bin/activate

Install required python packages

$ pip install -U -r requirements.txt

Configure the application, postgresql database

$ umask $(umask && umask 077 && cp

Do database initialization, populate static files

$ python migrate

Add an (admin) user to the system

$ python createsuperuser

Additional settings

Edit for other local needs.

SPI and GPIO setup

Probably you will need to grant permissions to access the devices under /dev, so first create a group for that purpose, add the thermo user to that group, and create the necessary udev rule files:

# groupadd -r spidev
# adduser thermo spidev
# cat > /etc/udev/rules.d/51.spidev.rules <<EOF
SUBSYSTEM=="spidev", ACTION=="add", GROUP="spidev", MODE="0660"

You will have to select the GPIO for the interrupt-driven packet receiving engine to work. It is up to you which GPIO you choose on your PI, you should connect that to the GDO0 pin of the CC1101 module. Then you may use the script to expose that GPIO to userspace, with:

# ~thermo/thermo-center/bin/ 272 spidev in # Banana PI M1+ GPIO

And configure this GPIO in

Using the attached adapter , with one CC1101 module one may use the following table:

Board GPIO pin name
Banana PI M1+ 272 PI16
Banana PI M2 200 PG8
Banana PI M2+ 2 PA2

(Others to be listed here...)

Frontend setup (www)

You will need an nginx (or other) web server and proxy which can proxy requests to django via uwsgi. The default installation assumes that the application will be reached in the /tc/ URI, which can be set via WWW_ROOT in With the default installation, the corresponding nginx configuration looks like this:

server {
        listen 80 default_server ;
        listen [::]:80 default_server ;

        root /var/www/html;

        location /tc/ {
                alias /home/thermo/thermo-center/www/;
        location /tc/api/ {
                include uwsgi_params;
        # Below is only needed if you plan to use Django admin site
        location /tc/admin/ {
                include uwsgi_params;

If you plan to deploy it in the root of your domain, set WWW_ROOT to '', and adjust nginx config appropriately.

After, populate django admin static files:

$ python collectstatic --noinput --clear

And build the web UI files. You will need nodejs and npm to be installed for this to work.

$ cd www && npm install && sh

Start the application (the receiver daemon & uwsgi application)

$ ~/thermo-center/bin/

If everything is set up correctly, you may open your browser at http:///tc/ and using the user/password you will see an empty page with 3 buttons on it. Thats all!

Configuring sensors