HomeKit Accessory Protocol for OpenBSD

OpenHAP puts MQTT-connected Tasmota devices into Apple’s Home app. An iPhone pairs with openhapd as if it were an accessory; openhapd speaks MQTT to the real ones. Neither end needs to know the other exists.

It is written in Perl against the base system. There is no bridge appliance to buy, no cloud account, no container, and no vendor between the phone and the thermostat — a daemon, a configuration file, and rcctl.

Design

Native to OpenBSD
Base-system Perl and a short list of packages. Runs as _openhap, starts from rc.d, and confines itself with pledge(2) and unveil(2).
The protocol, not a library binding
Pairing and session setup are implemented directly: SRP-6a, Ed25519, X25519, ChaCha20-Poly1305, HKDF-SHA-512, and TLV8 carried over encrypted HTTP/1.1, advertised by mDNS.
Devices as configuration
Accessories are declared in openhapd.conf(5) and loaded at start-up. Thermostats, heaters, switches, sensors, lightbulbs and dimmers are supported today.
Small enough to read
Every module is documented, every behaviour is tested, and the whole thing is a checkout you can audit in an afternoon.

Getting started

git clone https://github.com/dickolsson/openhap.git
cd openhap
make deps
doas make install

That leaves a daemon that still needs a user, a configuration file and a running MQTT broker. Install covers all of it, and Manuals is the reference for the daemon, the control utility and the configuration format — plus a page per module for anyone reading the source.

Sub-projects

Two pieces grew out of OpenHAP and are documented separately, because neither is about HomeKit: FuguLib, the OpenBSD-style daemon utilities the server is built on, and OpenHVF, which installs and manages OpenBSD virtual machines under QEMU — useful to anyone who needs an OpenBSD machine on demand, and used here to run the tests.