This project is impemented Apple Homekit Accessory Protocol(HAP) to ESP32. You can make your own Homekit accessory with ESP32 with this project.
This project is modified from younghyunjo, which is not working on my esp32 devkitc/wrover-kit. So I modify it to make it work on my board.
light/switch:
temperature/humidity:
The esp32-homekit
is using esp-idf libraries and build. Please download ESP-IDF and the corresponding compiling tools.
-
ESP-IDF
- Based on ESP-IDF Release v3.3 (LTS) ,Documentation for release v3.3 is available at https://docs.espressif.com/projects/esp-idf/en/v3.3/
- This archive can also be downloaded from Espressif's download server: https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v3.3.zip
-
Compile tool
https://dl.espressif.com/dl/esp32_win32_msys2_environment_and_toolchain-20181001.zip
esp32-homekit uses WiFi as tranmission layer. To connection WiFi, you MUST config WiFi ssid and password.
- Open examples/switch/main/main.c
- Change EXAMPLE_ESP_WIFI_SSID, and EXAMPLE_ESP_WIFI_PASS
#define EXAMPLE_ESP_WIFI_SSID "123"
#define EXAMPLE_ESP_WIFI_SSID "12345678"
Or you you can change it bymake menuconfig
and change the App WiFi config
.
$ cd examples/switch
$ make -j8
$ make flash monitor -j8
While pairing accessory and iOS devices, You must enter Setup Code at HOME App. The default setupt code is
Then you can control your device by Home
app or Siri
.
-
在$(patsubst %.c,%.o,$(dir) )中,patsubst把$(dir)中的变量符合后缀是.c的全部替换成.o,任何输出。