The HobbyIoT DOG system is intended to implement a remote monitoring and control by using the very popular Raspberry Pi single board computer together with one or more simple web cameras and a 3G modem. A number of applications and scripts are installed within the standard Raspbian distribution to make the system reliably up and running.
In this article I will show you the technology used to control the HobbyIoT DOG system over an MQTT bridge.
The implementation includes two Raspberry Pi boards running Mosquitto MQTT. The Local Pi is within a LAN, has an internal IP 192.168.3.14 (example) and is connected to the Internet Service Provider (ISP) via Router. The Router is set up to forward port 8883 (Mosquitto MQTT secure port) for connections to the internal IP address of the Local Pi. The Remote Pi has a specific config file with the Local Pi IP address and list of topics to be forwarded over the bridge.
Once the remote Pi MQTT Broker starts it reads the config file and establishes the connection to the Local Pi over the network. Only topics, mentioned in the Remote Pi config file are bridged. Naming conventions allow topic name translation and also definition of the data flow direction (in/out).
When a Topic 1 or Topic 4 (non bridged) from the Local Pi has data to transfer, this data is only used within the Local Pi connected MQTT clients. In case Topic 2 or Topic 3 has a data to transfer this data is also transferred over the bridge to the Remote Pi. Data direction is defined in the MQTT Bridge config file.
In my implementation I have bridged topics related to Remote Pi temperature, keep alive messages in direction Remote to Local Pi. In the direction Local to Remote Pi I have implemented some commands for taking pictures by the cameras connected to the remote Pi. See section HobbyIoT DOG: Commands Flow for further details.
Information, scripts and schematics will be available soon on GitHub.
Check the Slack channel #HobbyIoT of the project for questions and discussions soon!
The OpenHAB website: https://www.openhab.org/
The Mosquitto MQTT: https://mosquitto.org/
Nice and detailed bridge description: http://www.steves-internet-guide.com/mosquitto-bridge-configuration/