“The purpose of this project is to use the low-cost ESP8266 module to create a “Magic Switch” that can integrate with various home automation solutions such as Node-red, Home Assistant, Apple HomeKit (using Homebridge), and many more.
I decided to make use of MQTT as the messaging protocol for the Magic Switch because it is fast and reliable using custom firmware on the ESP8266 module known as Tasmota.
The purpose of the switch is to trigger an Automation or Scene in a smart home instance.
For this instructable you require a running instance of Homebridge and MQTT. Both these solutions can be easily installed on the low-cost Raspberry pi.
A good guide on getting started with Homebridge on the Raspberry pi can be found at this wiki or on the official Homebridge website.
Let’s get started…
You require at minimum the following for this project:
- ESP8266 and Programmer
- 3.3V Voltage regulator module (or similar)
- Project enclosure. Here is the 3D printable enclosure.
- 11 mm x 9 mm female power adapter
- Old DC power supply (5V-12V)
- Membrane ON/OFF switch
- Running MQTT broker
- Running Home Automation hub (in this case Homebridge)
Having a soldering iron and hot glue will assist you greatly.”