ESP8266EX Fun With Relay Module, Home Assistant & MQTT Take this simple c++ program, upload it to ESP8266EX and you will be able to switch on and off relay from Home Assistant.