Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] topic alias

Hello and happy new year to everybody. I am using mosquitto in a home automation project, connecting multiple raspberry and controlling them from a central one using node-red.
Every raspberry produce or receive messages from/to his gpio ports with this mqtt topics:


with minor variations. When i receive the messages in the central node-red i use them to automate various stuff. The problem is that my automation logic become cluttered with this topics that indicate not what is connected to it but which raspberry and gpio port. 

One solution to this problem could be to rename all the topics in the raspberrys to represent what is connected to it, but i don't really like that because 
a) i would lose the indication of where it is connected, which is really useful in case of problems, and
b) that would mean continuously editing the many raspberry node-reds when i connect something new or change a port or stuff like that.

A better solution would be to use topic forwarding, for example subscribing to the topic raspberry-a/gpio12 and forwarding every message to aquarium/moon-light. That would allow to have automation logic independent from the locations of the devices, but also keep that information for when it's needed. 
My worry is: how big is the performance penalty of having all topics subscribed and republished with different topics in mosquitto? keep in mind that the raspberry pi it's not the fastest machine around... 
Is there a better way to have this kind of topic aliasing? 
Roberto Previdi

Back to the top