How to (or not) Heat Recovery Ventilation with ESPHome / RS485 or I2C

We have automated a Heat Recovery Ventilation with ESPHome. My friend built the hardware and I built the software. So this is mostly about the software.

Components:

  • Heat Recovery Ventilation in the basement
  • New control unit using ESPHome in the basement
  • New control unit using ESPHome in the flat for communication with control unit in basement and connection to Home Assistant
  • Communication on existing wire between the two control units, using RS485 or I2C (see below)

First, I tried an approach using I2C. Both Master and Slave were implemented in ESPHome, using additional C++. On short connections, communication was very reliable. On a long connection of 10 meters, I failed. Code, documentation and experiences here:

I2C Version:

Therefore, in my second approach, I used RS485. The system is not yet installed, but tests with a long cable show 100% reliability.
Code, documentation and experiences here:

RS485 Version:

It was my first use of ESP32, of ESPHome and also my first use of C++. It was a long walk.