Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

smt116/heating-brain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heating Brain

Heating Brain is a hobby project and kind of a playground. It means the code may change a lot, and there are several places for improvements.

I've started the project because I was very disappointed about "the industry device" for controlling the floor heating system in my house. It turned out that it is highly inefficient and lacks features that I would like to have. I decided to buy a Raspberry PI Zero, a Relay controller, a few 1-wire sensors and put it together. I created this application to:

  • allow checking the temperatures, valves state, and gas stove via UI (i.e., heating-brain.local),
  • ensure the controller won't enable gas stove until there is a sufficient heating extraction (i.e., enough floor sections are opened),
  • allow introducing a complex "expected temperates time-table" for all sections.

In the future, I would like to improve the system by teaching it when to start the gas stove to achieve the expected temperature on a given hour in a given section (handling the thermal inertia of the floor).

The controller already gave my 20-30% better performance than "the industry device" in terms of gas consumption.

Requirements

See .tool-versions file.

Deployment

./server/deploy

Raspberry Pi Zero Setup

On the memory card

  1. Install Raspbian Buster Lite on the memory card. See official documentation for details.

  2. Copy server/config.txt into the card (as config.txt).

  3. Configure network connection by creating wpa_supplicant.conf file on the card with the following content (adjust the credentials):

    country=PL ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="[wifi-name]" psk="[wifi-password]" key_mgmt=WPA-PSK } 
  4. Enable SSH by creating ssh file.

From host system after booting the server:

  1. Allow password-less SSH connections:

    ssh-copy-id pi@[ip] 

On the server

  1. Set the hostname:

    sudo sed -i 's/raspberrypi/heating-brain/g' /etc/hostname sudo sed -i 's/raspberrypi/heating-brain/g' /etc/hosts 
  2. Fix the cannot change locale (en_US.UTF-8) issue:

    sudo sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen sudo locale-gen en_US.UTF-8 sudo update-locale en_US.UTF-8 
  3. Set the new password:

    sudo passwd pi 
  4. Upgrade distro:

    sudo apt-get update sudo apt-get dist-upgrade sudo apt-get autoclean 
  5. Install Erlang and Elixir.

  6. Configure rsyslog (optional):

    # /etc/rsyslog.d/01-ignore-rngd.conf if $programname == 'rngd' then /var/log/rngd.log & stop if $programname == 'rng-tools' then /var/log/rngd.log & stop # /etc/rsyslog.d/02-cron.conf if $programname == 'cron' then /var/log/cron.log & stop # /etc/rsyslog.d/99-nas.conf use local address like "rsyslog.local" *.* @192.168.2.10:514 $ActionQueueFileName queue $ActionQueueMaxDiskSpace 1g $ActionQueueSaveOnShutdown on $ActionQueueType LinkedList $ActionResumeRetryCount -1 # /etc/logrotate.d/rsyslog /var/log/rngd.log { rotate 4 weekly missingok notifempty compress delaycompress sharedscripts postrotate /usr/lib/rsyslog/rsyslog-rotate endscript 
  7. Create application directories:

    mkdir -p /srv/backups /opt/heating_brain chown pi:pi /opt/heating_brain/ /srv/backups/ 
  8. Configure backups:

    # Add in crontab: 0 * * * * /opt/heating_brain/_build/prod/rel/heating_brain/bin/heating_brain rpc ':ok = Collector.Storage.create_backup()' 15 10 * * * find /srv/backups -type f -mtime +14 -ls -exec rm -f -- {} \; 

From host system after setting up the server:

  1. Deploy the code:

    ./server/deploy 

    The first deployment will be significantly longer.

Resources

About

PoC application for managing floor heating system

Topics

Resources

Stars

Watchers

Forks

Contributors