This is an example for building custom HomeKit appliances using Homebridge and ESP8266-based micro-controllers. It uses DNS-SD/Bonjour/Zeroconf for service discovery and MQTT for communication between the Homebridge plugin and the ESP8266 based micro-controller(s).
Be sure to have Docker and Docker Compose installed and running on your host, in my case a Raspberry Pi Zero W. The included docker-compose.yml defines all the required services to get started, including
- Eclipse Mosquitto, a MQTT broker.
- Avahi, a DNS-SD/Bonjour/Zeroconf service, which helps discovering the MQTT broker inside your network without fiddling with IP addresses.
- Homebridge, the actual Homebridge.
docker-compose up
mosquitto_sub -t esp8266/led/status
# => "on" or "off"
# Turn LED on
mosquitto_pub -t esp8266/led/action -m on
# Turn LED off
mosquitto_pub -t esp8266/led/action -m off
Before flashing the sketch onto your ESP8266, ensure to create a
sketch/config.h
based on sketch/config.example.h
using your WiFi
credentials. After booting and obtaining an IP, the ESP8266 searches for a MQTT
broker and subscribes to it. It will blink twice once it is ready.