Data Science Engineering Manager at WhiteHat Security, Trustee at Farset Labs and Vault Artist Studios
We previously had a well configured EMonPi set up with nice dashboards and things, but that died a death at some point during the move, who knows.
Anyway, EmonPi has a built in mosquitto broker, which it uses to keep ‘state’ across several parts of the emonpi ecosystem.
I was expecting the kind of intricate surgury to ‘replace’ a core part of emonpi’s architecture with an ‘off-device’ broker, and all the failure that that would entail, but helpfully, the MQTT protocol has a concept of “bridgeing”, where you can effectively make one Broker ‘publish’ all it’s topics on another broker. Super Easy, Barely an Inconvenience.
Create a file called
bridge_over_the_river_que.conf* in the mosquitto/config/conf.d/ folder on the source device (in this case the emon pi), with the following contents *
#connection farset connection bridge-fsl address 192.168.1.222:1883 topic # out 0
If you want to make the ‘bridge’ bi directional, you can add
topic # in 0 to also grab everthing from the ‘destination’ broker, but in this case, we don’t want that.
If we wanted to be pedantic and to only forward
emon sensor topic values, or values from a particular device, you can replace the
# with the appropriate topic wildcard (you knew that you could do wildcards in MQTT right? Cus I didn’t!)
* Naturally, adjust the values to something that makes sense in your setup….