Skip to content

MatthiasJobst/ESPSomfy-RTS

 
 

Repository files navigation

ESPSomfy-RTS with Homekit

Note for this fork

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.

Hardware requirements

Flash size

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.

Tested hardware

CC1101 wiring (ESP32-S3)

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

Build environment

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

CC1101 driver notes (arduino-esp32 v3.x)

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:

  1. SPI.begin(..., -1) — pass -1 for the SS argument so the pin is not routed through the hardware CS peripheral, allowing Reset() to strobe it manually via digitalWrite.
  2. SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)) added to SpiStart() — on v3.x SPI.transfer() without a prior beginTransaction() does not configure the hardware clock and hangs indefinitely.
  3. SpiEnd() is called immediately after Reset() in Init(), before RegConfigSettings() — this prevents a mutex deadlock caused by RegConfigSettings()SpiWriteReg()SpiStart()beginTransaction() trying to re-lock the non-reentrant SPI mutex while the outer Init() still holds it.

About

A controller for Somfy RTS shades and blinds

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C++ 57.5%
  • JavaScript 26.1%
  • HTML 9.4%
  • CSS 7.0%