All the ESPs are sending MQTT messages to an MQTT broker (I have an ESP8266 acting as a broker) inside the house. The MQTT broker is also bridging all the data to another MQTT broker instance that I have in a cloud. From now there are two cases:
1. If I am in my WiFi coverage, my mobile app is connecting over the websokets to the MQTT broker and sees all the devices, control them etc.
2. If I am not in my Wifi coverage my mobile app is connecting to the cloud MQTT broker over websockets and sees all the devices, control them etc.
I've chosen to have connection between the mobile application and both MQTT brokers, instead to have one connection to the cloud broker, because if you are at home and your internet connection is down you can not control any device. Having a connection directly to your home MQTT broker is covering this scenario.
The mobile application first is connecting to the local MQTT broker and if is not succeed ( means you are not at home) it connecting to the cloud MQTT broker. This is done automatically and is transparent to the user.
As you can see no port forwarding, nothing to do in your router.
|My IoT home control system|