This code has been created to merge the ESPSomfy-RTS controller with Homekit. This should allow the device to connect directly with homekit and expose shades there.
NOTE: THIS HAS BEEN CREATED WITH THE HELP OF AI.
For all technical details like how to build the appropriate device, please refer to ESPSomfy-RTS. This project has followed the same approach.
The HomeKit branch requires a minimum of 8 MB flash. The HomeKit Accessory Protocol (HAP) stack adds pinned partitions near the top of flash, and two OTA app slots at 3 MB each leave no room to fit within a 4 MB device. Devices with 4 MB flash (e.g. standard ESP32, ESP32-C3) are not supported by this fork.
| CC1101 pin | ESP32-S3 GPIO |
|---|---|
| GDO0 | GPIO 3 |
| GDO2 | GPIO 4 |
| CSN | GPIO 6 |
| SCK | GPIO 7 |
| MISO | GPIO 8 |
| MOSI | GPIO 9 |
| VCC | 3.3 V |
| GND | GND |
This project targets ESP-IDF v5.5 with arduino-esp32 v3.x embedded as a component (not the Arduino IDE).
idf.py build
idf.py -p /dev/cu.usbmodem<PORT> flash monitor
The upstream SmartRC-CC1101-Driver-Lib was written for arduino-esp32 v2.x. The copy in components/CC1101/ contains three fixes required for v3.x:
SPI.begin(..., -1)— pass-1for the SS argument so the pin is not routed through the hardware CS peripheral, allowingReset()to strobe it manually viadigitalWrite.SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0))added toSpiStart()— on v3.xSPI.transfer()without a priorbeginTransaction()does not configure the hardware clock and hangs indefinitely.SpiEnd()is called immediately afterReset()inInit(), beforeRegConfigSettings()— this prevents a mutex deadlock caused byRegConfigSettings()→SpiWriteReg()→SpiStart()→beginTransaction()trying to re-lock the non-reentrant SPI mutex while the outerInit()still holds it.