HomeKit
ESP8266 HomeKit Contact Sensor with a Hall Sensor
A general contact sensor for Apple HomeKit: use it on anything that opens and closes, and the Home app shows whether it is open or closed.
- ESP8266
- HomeKit
- 2 min read
A general Hall-sensor contact sensor for the Home app, for anything that opens and closes.
It is one of four versions of the same sensor, which differ in the application. The hardware and the circuit are the same as in the ESP8266 HomeKit Window Contact Sensor, which explains how the A3144 Hall sensor, the resistors and the housing work.
How it works
A magnet on the moving part, a Hall sensor on the fixed part, and an ESP8266 that reports the state to the Home app. In the Home app you choose how the sensor is displayed: as blinds, a contact sensor, a door, a garage door or a window. This is a test setup.
For the wiring, the circuit and the datasheet details of the sensor, follow the window contact sensor article.
Flash and install
The installation is the same as for the other ESP8266 HomeKit accessories on this site. The firmware runs on ESP-Open-RTOS with Life Cycle Manager 2, which sets up the WiFi and installs updates over the air. The full steps, from installing esptool to flashing, joining the LCM- WiFi network and pairing, are in ESP8266 HomeKit Blinds.
In the portal, use these values:
| Field | Value |
|---|---|
| OTA repository | AchimPieters/ESP8266-HomeKit-Contact-Sensor |
| OTA binary file | main.bin |
The portal also has a setting for the LED pin. For a high output, use the active-high option, “If active on 1”.
When the installation is done, scan the QR code the device generates in the Home app to add it.
Firmware release
| Version | Date |
|---|---|
| 0.0.3 | 10 May 2021 |
The release has a main.bin and a signature file, main.bin.sig.
Good to know
- This is a test setup and not a finished product.
- The HomeKit Accessory Protocol specification the firmware follows is the non-commercial version, for accessories you build yourself and do not distribute or sell.
- The repository is under the MIT licence and holds the firmware release, not the source code.
Everything is in the ESP8266-HomeKit-Contact-Sensor repository on GitHub.
More HomeKit
Keep building.
Switches, sensors, plugs and blinds: more accessories that you build yourself and add to the Home app.
All HomeKit

