HomeKit Accessory Protocol for OpenBSD
OpenHAP shows MQTT-connected Tasmota devices in the iOS Home app. An
iPhone pairs with openhapd as a HomeKit accessory;
openhapd uses MQTT to control the real devices.
The server is Perl code on the base system: a daemon, a configuration
file in /etc, and rcctl. It does not need a cloud
account or a separate appliance.
Design
- Native to OpenBSD
- OpenHAP uses base-system Perl and a short list of packages. The daemon
runs as
_openhap, starts fromrc.d, and limits itself with pledge(2) and unveil(2). - Pairing and sessions
- Pair-setup is an SRP-6a exchange over the RFC 5054 3072-bit group;
pair-verify is X25519 with Ed25519 signatures. ChaCha20-Poly1305 encrypts
the sessions with keys from HKDF-SHA-512. The messages are TLV8 and JSON
over HTTP/1.1, and
mdnsdadvertises the service. This project supplies the SRP exchange and the framing; CPAN modules supply the primitives. - Devices as configuration
- You declare the accessories in
openhapd.conf(5), and the daemon loads them at startup. OpenHAP supports thermostats, heaters, switches, sensors, lightbulbs, and dimmers today. - Small enough to read
- Each module has a manual page or a POD sidecar, and the tests are
adjacent to the source in
t/.
Quick start
git clone https://github.com/dickolsson/openhap.git
cd openhap
make deps
doas make install
After these steps, the daemon also needs a user, a configuration file, and an MQTT broker. Install shows each step. Manuals is the reference for the daemon, the control utility, and the configuration format. There is a page for each module for readers of the source.
Related projects
Three projects have their own repositories and documentation, because they are not related to HomeKit. Fugu holds the OpenBSD-style daemon utilities that the server uses. FuguVM installs and manages OpenBSD virtual machines under QEMU; this project uses it to run the tests. FuguWeb builds this website.