HomeSpan is a free, open source automation project written in C++ and released under MIT. It has 2,165 GitHub stars, 199 forks and 9 open issues, and was last pushed 3 days ago. On this registry it ranks #41 of 54 tracked projects in Automation, with 5 head-to-head comparisons available. It gained 2 stars over the last 3 tracked days.

What is HomeSpan?

What it is

HomeSpan is an MIT-licensed C++ Arduino library for the Arduino-ESP32 ecosystem. It lets developers build HomeKit devices on Espressif ESP32 microcontrollers without external bridges or components. The project implements Apple's HomeKit Accessory Protocol Specification Release R2, called HAP-R2, and pairs directly to HomeKit through a home WiFi network.

The concrete problem it solves is that custom ESP32 devices may otherwise need external bridges or components to join HomeKit. HomeSpan provides a microcontroller-focused HAP-R2 implementation that pairs directly over the home WiFi network, although Apple's HomeKit architecture requires a HomePod or Apple TV Home Hub for full operation. It targets custom control software and hardware for the Home app or Siri.

Key capabilities

  • HomeSpan operates in Accessory mode or Bridge mode, so one ESP32 device can expose one or multiple HomeKit accessories.
  • It supports pairing with Setup Codes or QR Codes, and WiFi or Ethernet connectivity.
  • It provides dozens of integrated HomeKit Services and 100% HAP-R2 compliance.
  • It includes classes for the ESP32's 16-channel PWM peripheral to control LED brightness with auto-fading and servo motors.
  • It handles push-button and toggle-switch presses, including single, double, and long presses on ESP32 pins or touch pads.
  • It provides a command-line interface, real-time diagnostics, and built-in database validation.
  • It supports dual-stack IPv4 and IPv6 addresses.

Who uses it and how

  • Developers use it inside the Arduino IDE to write C++ code for ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C5, and ESP32-C6 boards.
  • Developers use it to connect controls, LEDs, servos, IR or RF signals, and custom logic to the Home app or Siri.
  • HomeKit users add custom devices to a HomeKit setup with a HomePod or Apple TV Home Hub.
  • Developers use the Serial Monitor and command-line interface to inspect HomeKit actions, requests, and responses during testing.
  • Remote-sensor workflows can use an ESP-8266 with SpanPoint, although HomeSpan itself does not run on ESP-8266.

Getting started

Use the Arduino IDE with the HomeSpan Arduino library, version 2.1.8, and Arduino-ESP32 Core 3.3.0 or later. Select a supported ESP32 chip and configure the recommended Minimal SPIFFS 1.9MB APP with OTA partition scheme for 4MB-flash devices.

When to use it — and when not to

Use HomeSpan when you want an ESP32 HomeKit device built in the Arduino IDE, and when you can provide a HomePod or Apple TV Home Hub. Do not use it when you need ESP-8266 support as the main device, because it cannot run there. Do not use alpha, beta, or pre-release Arduino-ESP32 Core versions, because HomeSpan tests only production Core releases.

project readme (upstream, from github) — read inline

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.8 -
Supported Chips ESP32, S2, S3, C3, C5, and C6 [^8266]
Minimum Required Arduino-ESP32 Core 3.3.0 [^fail]
Latest Core fully tested with HomeSpan 3.3.8 [^tested]
Minimum Flash Partition Size 1.9MB -
Recommended Partition Scheme Minimal SPIFFS (1.9MB APP with OTA) [^partition]
HomeKit Hub HomePod or Apple TV [^homehub]

[^8266]:HomeSpan cannot be run on an ESP-8266, though an ESP-8266 can be used as a remote sensor in conjunction with HomeSpan's SpanPoint functionality

[^fail]: 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

[^tested]: 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.

[^homehub]: 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.

[^partition]: 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)

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 class that faciliates 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.8 (26 APR 2026)

New Features

  • Updated HomeSpan Status logic and functionality for improved diagnostics

    • Added new HS_STATUS enum type HS_CONNECTED
      • reflects fully operational state where HomeSpan is connected to a WiFi or Ethernet network, paired to HomeKit and is maintaining one or more secure connections to HomeKit
      • Status LED set to steady ON when in this state
    • Modified HS_STATUS enum type HS_PAIRED
      • reflects potential "No Response" state where HomeSpan is connected to a WiFi or Ethernet network, paired to HomeKit but does not (yet) have any open secure connections to HomeKit
      • Status LED set to inverted double-blink when in this state
    • Added new std::pair homeSpan.getStatus() method
      • returns std::pair containing:
        • current HomeSpan Status as HS_STATUS enum type
        • duration (in seconds) since HomeSpan first changed to that Status
      • this thread-safe method allows user to actively poll HomeSpan status and duration from the main loop() as alternative to using homeSpan.setStatusCallback() (which is only called when the HomeSpan Status changes)
    • Added new void homeSpan.resetStatusDuration() method
      • this thread-safe method allows user to reset current HomeSpan Status duration to zero
    • Complete re-write of HomeSpan Status documentation
      • demonstrates how to use the new methods above
      • provides example of using homeSpan.getStatus() to reboot HomeSpan if the device has lost secure HomeKit connections for an extended period of time
      • adds table providing graphic representation of all Status LED patterns for each HomeSpan Status state
      • adds direct link to this documentation on the main HomeSpan README.md page
    • See HomeSpan Status and the HomeSpan Status LED for details
  • Improvements to Web Log output

    • Added new Client Connections Table (similar output to 's' CLI command)
      • used as diagnostic to check whether HomeSpan has any active secure connections to HomeKit
    • Added descriptive class names for use with custom style sheets
      • body - background and header text (can use bod1 for backwards compatibility)
      • infoTable - the top table that provides general information about the device (can use tab1 for backwards compatibility)
      • clientTable - the newly-added table listing all active client connections (can use tab2 for backwards compatibility)
      • logTable - the bottom table listed all the individual Web Log entries (can also use tab2 for backwards compatibility)
    • See Message Logging for details
  • Created ability to programmatically retrieve base-64 encoded Pairing Data from within a sketch

    • Added the following two new methods:
      • const char* homeSpan.getPairingInfo(char **buf)
        • allocates memory to buf and fills with HomeSpan's Device Pairing Data
        • returns buf, which must be de-allocated with free(buf) when no longer needed
      • const char* Controller::getPairingInfo(char **buf)
        • allocates memory to buf and fills with a Controller's Pairing Data
        • returns buf, which must be de-allocated with free(buf) when no longer needed
    • Using these methods duplicates the exact Accessory and Controller Pairing Data provided by the 'P' CLI Command needed to clone devices
    • See the API Reference for details on these methods and the Cloning Pairing Data page for a full example
  • Added new boolean homeSpan.usingEthernet() method

    • returns true if Ethernet interface is being used, else false if WiFi is being used
  • **Ad

readme truncated — read the full docs on github

Frequently asked questions

Is HomeSpan free to use?

HomeSpan is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does HomeSpan do?

HomeKit Library for the Arduino-ESP32

What is HomeSpan written in?

HomeSpan is primarily written in C++. Its source is publicly available at https://github.com/HomeSpan/HomeSpan, and it has 2,165 GitHub stars.