Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Arduino wrapper for ESP-IDF HomeKit library

License

NotificationsYou must be signed in to change notification settings

Brawrdon/esp-homekit-arduino-sdk

Repository files navigation

This library provides the officialESP-IDF HomeKit SDK (#fac2032) for ESP32 devices running the Arduino framework.

Version 2.0.0 is in active development and will be available soon!

Note: This wrapper uses a version of the SDK which can't be used in commercial products due to it not being MFi certified, feel free to use it in your hobby projects though!

Installation

If you're usingPlatformIO, update yourplatformio.ini file's dependancies or use thepio command in the directory containing yourplatformio.ini file:

pio lib install'ESP32 HomeKit SDK for Arduino'

The packages uploaded to PlatformIO's repository and used by the Arduino IDE will contain the complete library, as the build script will be run before packaging. You can use the Arduino IDE to install the library by downloading the prebuilt ZIP file in the Releases section.

Usage

At the moment, only a temperature sensor with a default value can be created. I'm in the process of adding the ability to read / write to a sensor, as well as adding all other available sensors.

#include<Arduino.h>#include<WiFi.h>#include<ESP32HomeKit.h>constchar *ssid ="ssid";constchar *password ="password";/*This example provides a basic connection to HomeKit.You can't read/write values at the moment but it's coming I promise.*/voidsetup(){Serial.begin(9600);WiFi.begin(ssid, password);while (WiFi.status() != WL_CONNECTED){delay(1000);Serial.println("Establishing connection to WiFi..");}Serial.println("Connected to network.");HAPAccessoryhapAccessory("ESP32 Fan");hapAccessory.Setup("EspFan01","Espressif","001122334455","0.0.1","1.0.0", HAP_ACCESSORY_SENSOR);HAPTemperatureSensorhapTemperatureSensor("Temperature",10.0);hapAccessory.AddService(hapTemperatureSensor.Service);hapAccessory.Register();HAPCorehapCore("111-22-333","ES32");hapCore.Start();}voidloop(){/* Main loop code*/}

Building From Source

If you want to make edits to the library, run thebuild.sh script. It will clone the ESP-IDF HomeKit SDK repository, copy the required source files and modify them to work with Arduino's build chain. The modified files aren't commited as I don't think I need to host copies of the SDK's source in this repository, or in a fork, since the changes for the port are minimal.

To Do

  • Add Arduino API wrappers to make it easier to use.
  • [] Add other sensors.
  • [] Better documentation.

License

MIT

Sponsor this project

 

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp