8000 GitHub - HomeSpan/HomeSpan at dev · GitHub
[go: up one dir, main page]

Skip to content
HomeSpanPublic

About

HomeKit Library for the Arduino-ESP32

Topics

Resources

Stars

2.2k stars

Watchers

38 watching

Forks

 
 

Latest commit

 

History

2,480 Commits

Folders and files

Repository files navigation

Welcome!

Welcome to HomeSpan - a robust and extremely easy-to-use Arduino library for creating your own ESP32-based HomeKit devices entirely within the Arduino IDE.

HomeSpan provides a microcontroller-focused implementation of Apple's HomeKit Accessory Protocol Specification Release R2 (HAP-R2) designed specifically for the Espressif ESP32 microcontroller running within the Arduino IDE. HomeSpan pairs directly to HomeKit via your home WiFi network without the need for any external bridges or components. With HomeSpan you can use the full power of the ESP32's I/O functionality to create custom control software and/or hardware to automatically operate external devices from the Home App on your iPhone, iPad, or Mac, or with Siri.

Requirements

Component Requirement See Note
Current HomeSpan Production Release 2.1.9 -
Supported Chips ESP32, S2, S3, C3, C5, and C6 1
Minimum Required Arduino-ESP32 Core 3.3.0 2
Latest Core fully tested with HomeSpan 3.3.10 3
Minimum Flash Partition Size 1.9MB -
Recommended Partition Scheme Minimal SPIFFS (1.9MB APP with OTA) 4
HomeKit Hub HomePod or Apple TV 5

HomeSpan Highlights

  • Provides a natural, intuitive, and very easy-to-use framework
  • Utilizes a unique Service-Centric approach to creating HomeKit devices
  • Takes full advantage of the widely-popular Arduino IDE
  • 100% HAP-R2 compliance
  • Dozens of integrated HomeKit Services
  • Operates in either Accessory or Bridge mode
  • Supports pairing with Setup Codes or QR Codes
  • Supports both WiFi and Ethernet connectivity to your home network
  • Supports dual-stack use of both IPv4 and IPv6 addresses

For the HomeSpan Developer

  • Extensive use of the Arduino Serial Monitor
    • Real-time, easy-to-understand diagnostics
    • Complete transparency to every underlying HomeKit action, data request, and data response
    • Command-line interface with a variety of info, debugging, and configuration commands
  • Built-in database validation to ensure your configuration meets all HAP requirements
  • Dedicated classes that utilize the ESP32's 16-channel PWM peripheral for easy control of:
    • LED Brightness (including auto-fading)
    • Servo Motors
  • Integrated Push Button and Toggle Switch functionality supporting single, double, and long presses of:
    • Physical pushbuttons that connect an ESP32 pin to either ground or VCC
    • Touch pads/sensors connected to an ESP32 pin (for ESP32 devices that support touch pads)
  • Integrated access to the ESP32's on-chip Remote Control peripheral for easy generation of IR and RF signals
  • Dedicated classes to control one- and two-wire addressable RGB LEDs and LED strips
  • Dedicated classes to control stepper motors that can run smoothly in the background without interfering with HomeSpan
  • Dedicated companion library that facilitates seamless point-to-point communication between ESP32 devices using ESP-NOW
  • Integrated Web Log for user-defined log messages
  • Extensively-commented Tutorial Sketches taking you from the very basics of HomeSpan through advanced HomeKit topics
  • Additional examples and projects showcasing real-world implementations of HomeSpan
  • A complete set of documentation explaining every aspect of the HomeSpan API

For the HomeSpan End-User

  • Embedded WiFi Access Point and Web Interface to allow end-users (non-developers) to:
    • Set up Homespan with their own home WiFi Credentials
    • Create their own HomeKit Pairing Setup Code
  • Status LED and Control Button to allow end-users to:
    • Force-unpair the device from HomeKit
    • Perform a Factory Reset
    • Launch the WiFi Access Point
  • A standalone, detailed End-User Guide

❗Latest Update - HomeSpan 2.1.9 (DD MMM 2026)

New Features

  • Introducing SpanCast!

    • a new standalone companion library for HomeSpan that provides seamless point-to-point communication between devices using ESP-NOW
    • offers significant advantages over HomeSpan's current SpanPoint class, including:
      • full support for ESP32 and ESP8266 devices
      • more robust WiFi synchronization
      • more options for queue management and per-device encryption settings
      • and most importantly --- users do not need know the MAC addresses of any device or hardcode MAC addresses into any sketch!
    • see HomeSpan's SpanCast Repository for details and complete documentation
    • also see the new RemoteSensors example demonstrating how SpanCast can be used to create a remote simulated Air Quality Sensor linked to HomeKit
    • ❗note SpanPoint is now marked as deprecated in HomeSpan and will be removed from the library in a future release. Please use SpanCast instead
  • Added ability to use inline lambda-functions with variable capture in the first form of SpanUserCommand() (the one that does not include a user-defined argument)

    • other HomeSpan callbacks, including the second form of SpanUserCommand() (the one that includes a user-defined argument), have always allowed for lambda functions, but without any variable capture
    • allows capture of objects using the this pointer, and subsequent reference to object members
    • example: new SpanUserCommand('N',"<name> - rename NeoPixel",[this](const char *buf){cfgName.setString(buf+1);});
    • see API Reference for details

See Releases for details on all changes and bug fixes included in this update.

HomeSpan Resources

HomeSpan includes the following documentation:

Note that all documentation is version-controlled and tied to each branch. The master branch generally points to the latest release. The dev branch, when available, will contain code under active development.

Companion Libraries

Standalone libraries designed to work with HomeSpan. Links to separate repositories with full documentation and complete examples:

  • HomeSpan SpanCast - provides point-to-point, bi-directional communication between ESP32 Devices using ESP-NOW. See also the RemoteSensors example on the Tutorials page

Translated Documentation

A user-created repository containing a Chinese translation of the HomeSpan documentation can be found at https://github.com/abackup/HomeSpan-Chinese. Note HomeSpan is not responsible for the content of this repository - please direct any questions about the content of the translations to the issues page for that repository.

External Resources

In addition to HomeSpan resources, developers who are new to HomeKit programming may find useful Chapters 8 and 9 of Apple's HomeKit Accessory Protocol Specification, Non-Commercial Version, Release R2 (HAP-R2). This document is unfortunately no longer available from Apple (perhaps because it was last updated July, 2019, and is now somewhat out-of-date). However, you may be able find copies of this document elsewhere on the web. Note Apple has not replaced the HAP-R2 document with any other versions for non-commercial use, and Apple's open-source HomeKit ADK only reflects the original HAP-R2 specs (rather than all the latest Services and Characteristics available in HomeKit for commercial devices).


Matter and Thread

There are no plans to make HomeSpan compatible with Matter since HomeSpan was structured entirely around HAP R2. In addition, both Apple and Espressif have released Matter SDKs for public use, reducing the need for yet another Matter SDK.

Feedback or Questions?

Please post bug reports or other problems with HomeSpan to the Issues Board. Please post all other questions about HomeSpan (use, functionality, specs, examples, etc.) or any ideas or recommendations you may have for new functionality, or any general feedback about HomeSpan or HomeKit, to the Discussion Board. For more general questions or feedback not related to a specific HomeSpan issue or function, you can email me directly at homespan@icloud.com.

About the Author

HomeSpan was developed and continues to be maintained and supported by Gregg Berman. It was originally conceived to solve the pesky problem of not being able to operate an RF-controlled kitchen vent hood with Siri. I hope you find it useful as well as fun to use.

This is my second large-scale open-source project --- my first was the design of an open-source sytem for operating model railroads using nothing more than an Arduino Uno and Arduino Motor Shield to generate digital command and control (DCC) signals. Though I have not been involved with the model railroading hobby for many years, videos showcasing my original system (dubbed DCC++), along with detailed tutorials of how it works, are still available on the DCC++ YouTube Channel.

Footnotes

  1. HomeSpan cannot be run on an ESP-8266, though HomeSpan's SpanCast companion library does provide full support for ESP-8266 devices to be used as remote sensors for HomeSpan ↩

  2. The current production release of HomeSpan will fail to compile under any Arduino-ESP32 Core release earlier than the minimum version listed. However, prior versions of HomeSpan can be compiled and run under earlier versions of the Core. The README file under the HomeSpan branch for each release provides details on which version of the Core can be used for that release ↩

  3. Later releases may work fine, but have not (yet) been tested. Note HomeSpan does not support the use of alpha, beta, or pre-release candidates of the Arduino-ESP32 Core - testing is only done on production releases of the Core. ↩

  4. This recommendation assumes an ESP device with 4MB of flash memory. For devices with 8MB or more of flash memory you may choose any partition scheme that provides at least 1.9MB APP space and 1.9MB of OTA space (if using OTA) ↩

  5. Apple's HomeKit architecture requires the use of a Home Hub (either a HomePod or Apple TV) for full and proper operation of any HomeKit device, including those based on HomeSpan. Use of HomeSpan without a Home Hub is NOT supported. ↩

About

HomeKit Library for the Arduino-ESP32

Topics

Resources

Stars

2.2k stars

Watchers

38 watching

Forks

Releases

Contributors

Languages

0