The home ventilation system is controlled via a small surface mounted box, that houses two components. A small control panel with some buttons to switch modes and a controller board, that basically drives the fans. The control panel and the controller board are connected with four wires. The outer two wires provide 12V DC for the board and the fans, while the inner two wires are used for a RS-485 bus. To control the home ventilation system, we disconnect the bus and build two busses with a Raspberry Pi in the middle.
+--------------------+--------------------+
| | |
| Controller | Control |
| | Panel |
| | |
| | | | |
+--------------------+--------------------+
| |
| +------+
+-------------------------+ |
| |
+--------------------+ | | <-- dual wires for RS-485
| | | |
| RaspberryPi |==|+ |
| | |
| |==|---+
+--------------------+ ^
|
USB-adapter
I was not able to identify the protocol used on the bus. It seems to be a proprietary protocol with an XOR "checksum" at the end of each message. The software uses the checksum to check whether a message from the control panel was received properly. The messages controlling the fans have been captured and are being replayed by the Pi. There are four messages from the control panel, that seem to have no effect on the system. They are probably meant to query sensors, that are not present in my installation. These messages are passed through by the software.
This software has been tested with Raspberry Pis 1 B+, Zero WH, 3 B+ and 4 B. For Pi 4 B an eeprom update might be necessary.
As RS-485 adapter I used this shield for development and these USB-adapters for production.
I assume you have a brand new Raspbian installed like described on raspberrypi.org.
- Install needed Raspbian packages
sudo apt install nginx python3-pip python3-serial gunicorn3 git
- Copy SeviControl to Pi
cd /home
sudo git clone https://github.com/incub77/sevicontrol.git
- Install Python dependencies
cd /home/sevicontrol
sudo pip3 install -r requirements.txt
- Allow none priviliged users access to USB ports
cd provisioning
sudo cp ./etc/udev/rules.d/50-sevicontrol-usb.rules /etc/udev/rules.d/
- Copy nginx config
sudo cp ./etc/nginx/nginx.conf /etc/nginx/
- Setup tmp files
sudo cp ./etc/tmpfiles.d/* /etc/tmpfiles.d/
- Register systemd services
sudo cp ./etc/systemd/system/* /etc/systemd/system/
sudo systemctl enable sevi-control
- Edit config.yaml to match your settings
sudo cp config.yaml.example config.yaml
sudo vi config.yaml
- Create system user & group
sudo addgroup --system sevictl
sudo adduser --system --home /home/sevicontrol/ --no-create-home --ingroup sevictl sevictl
- Change owner
sudo chown sevictl:sevictl -R /home/sevicontrol
- Setup runtime directory
sudo mkdir /run/sevi-control
sudo chown sevictl:sevictl /run/sevi-control
- Restart
sudo shutdown -r now