/esp32-homekit

esp32 apple homekit

Primary LanguageCApache License 2.0Apache-2.0

esp32-homekit

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.

Examples(new)

examples/led:

Using LEDC to control the light, which can dim the brightness.

examples/led-rgb:

Using LEDC to control the light, which can dim the brightness and the light color. This case uses the hsi2rgb algorithm, which is referred to lightbulb.c.

examples/led-strip:

refer to ESP32-NeoPixel-WS2812-RMT, and implement the led strip control.

examples/temphumi-ds18-gpu:

Using serial port LCD to display the status and connect to homekit.

Resource

Prerequisite

The esp32-homekit is using esp-idf libraries and build. Please download ESP-IDF and the corresponding compiling tools.

Configuration

WiFi

esp32-homekit uses WiFi as tranmission layer. To connection WiFi, you MUST config WiFi ssid and password.

  1. Open examples/switch/main/main.c
  2. 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.

Build

$ cd examples/switch
$ make -j8
$ make flash monitor -j8

Setup Code

While pairing accessory and iOS devices, You must enter Setup Code at HOME App. The default setupt code is

053-58-917

Then you can control your device by Home app or Siri.

makefile的一些说明

  • 在$(patsubst %.c,%.o,$(dir) )中,patsubst把$(dir)中的变量符合后缀是.c的全部替换成.o,任何输出。

    makefile中的patsubst