heizung is a utility written in python/flask to control some relays connected to an Raspberry Pi dependent on current temperatures of one or multiple sensors.
The rules (when a specific relay will be switched on) can base on multiple conditions linked with logical and or logical or. The conditions can be:
- compare the temperatures of two sensors
- compare the difference of the temperatures of two sensors with a specific value
- compare the temperature of a sensor with a specific value
Installing heizung on your Raspi is quite easy. Just follow these simple steps:
- Setup your hardware (more below)
- Clone the repo in
/opt[1] on your raspi, cd into this directory - Edit
config.pyto your needs (info below) export PYTHONPATH=././setup.sh- Copy the systemd-files from
./systemdto/etc/systemd/system; you can delete thesystemddirectory now. - start and enable systemd:
systemctl start heizungWebstart.servicesystemctl enable heizungWebstart.servicesystemctl start heizungSetupRelays.servicesystemctl enable heizungSetupRelays.servicesystemctl start heizungGetSensorValues.timersystemctl enable heizungGetSensorValues.timersystemctl start heizungSetRelays.timersystemctl enable heizungSetRelays.timer
| [1] | You can also choose another directory, but you have to edit the systemd-services if you do so. |
You can (and should) configure heizung using the config.py file.
First of all make shure to set Config.secret_key to an random (and secret) value.
Choose a location for the database and write it to Config.database_url.
You should not change the Hardware class if you use the hardware setup as described below.
Set System.dir_1w to the directory where your system puts the 1-wire devices.
On Raspbian this should be /sys/bus/w1/devices.
You'll need:
- Raspberry Pi
- Relay card
- DS18B20 temperature sensors
- female-female jumper wires
- some resistors and cable
The wiring is quite easy:
To use more than one temperature sensor, just connect multiple of them in parallel.
The flags marked with "R1", "R2", ..., "R8" have to be connected with the relay card. Maybe the relay card also needs GND and 5V. The resistors between RPi and the relay card are 1k.
