What is MQTT?
"MQTT is a publish-subscribe-based "lightweight" messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker. The broker is responsible for distributing messages to interested clients based on the topic of a message." [^1]
D1 Mini for our ESP8266
In this article we use the D1 Mini for the ESP8266, however this should work for all ESP8266s.
Setup an MQTT broker
Look at this guide on Digital Ocean for how to setup the Mosquitto MQTT broker on Ubuntu.
Secure the MQTT broker with username and password, and have the broker only accessible on a secure internal network.
ESP8266 communicate with the MQTT broker
We will be using the Homie framework using the Arduino Core. The Homie framework is an all-in-one solution for setting up the ESP8266 and communicating over MQTT using the Homie protocol.
[^1]: From Wikipedia, MQTT, visited 10/01/2017.