It is not uncommon to have multiple LoxBerry's in your home. This can be done to spread load, or because you have different hardware boards on your Raspberrys (e.g. Enocean Pi on one, and a Homematic board on another).
Some plugins using MQTT usually require to have the MQTT Gateway Plugin installed, that also installs it's seperate mqtt broker Mosquitto on each LoxBerry. With this setup, you have multiple brokers with different credentials, and the data are spread over multiple brokers.
The MQTT Gateway Plugin can not only serve as server, but also as client, connecting to another MQTT Gateway Plugin respectively Mosquitto broker on another LoxBerry.
To use this, follow these steps:
Define the "master" of your MQTT infrastructure
Select any of your LoxBerry's to be your "master" of the mqtt infrastructure. You will use the Mosquitto broker of this LoxBerry.
Simply install the MQTT Gateway Plugin on this LoxBerry.
In the Settings tab, keep the "Use the local Mosquitto MQTT broker" enabled (this is the default setting).
The username and password are required for all MQTT devices that want to connect to this broker.
Define MQTT Gateway Plugin client
On every additional LoxBerry you require MQTT features (for example, for a plugin that uses MQTT), also install the MQTT Gateway Plugin.
Navigate to the Settings tab of the plugin.
- Disable Use the local Mosquitto MQTT broker
- In MQTT Broker address enter the hostname and port of your "master" LoxBerry. Make sure that your "master" LoxBerry is available by the hostname, or use the ip address (in this case, make sure that the ip is static).
- In MQTT Broker username and MQTT Broker password enter the username and password shown on on the "master" LoxBerry's Settings tab.
Save and Apply the settings.
Navigate to the Subscriptions tab
Every MQTT Gateway Plugin will forward data of the local subscriptions defined on that LoxBerry to the selected Miniserver. Therefore, check that you only have subscribed topics in one MQTT Gateway Plugin. The same subscription on every LoxBerry will lead to multiple sends of the same data to the Miniserver.
Navigate to the Incoming Overview
In the Incoming Overview, you will see all data that are subscribed on this LoxBerry.
Finally, what happens to your data
Let's use the example with the Wifi Scanner plugin using MQTT, installed on your secondary LoxBerry, let's say LoxBerryB.
- On start of the Wifi Scanner scanning process, the Wifi Scanner plugin aquires the MQTT connection details from the locally installed MQTT Gateway plugin on LoxBerryB. The connection data lead to the "master" mqtt broker on LoxBerryA.
- The Wifi Scanner plugin therefore sends the data via mqtt to LoxBerryA.
Now it is your choice to add the subscription to LoxBerryA (that sends the data to the Miniserver configured in LoxBerryA), or to add the subscription on LoxBerryB (that sends the data to the Miniserver configured on LoxBerryB). Both LoxBerry's have access to the same data on LoxBerryA and can submit the data to the Miniserver.