MQTT Which client updated that payload?

My home automation system is essentially MQTT centric with multiple disparate controllers, devices and sensors integrated that way. Really happy with this architecture and It is evolving very nicely.

One thing that proves challenging though with MQTT is knowing which client changed a specific topic/payload. I started adding code in each client to provide this info, particularly for any command topics which are typically ending in …/set.

But rather than this laborious approach I was thinking about creating a NodeRED flow or similar that monitored verbose logging from mosquito, real time parsed the log and automagically published this for any topic ending …/set providing a …/setByClientID payload that identified the source client.

Does anyone know of or done anything similar that might be useful in this regard ?

I hear your pain. I put the source in the topic (eg. blah/button1/blah) and the subscribers that don’t care about the source use a wildcard (eg. blah/+/blah).

Parsing the log in real time sounds fragile. Maybe you could look at alternative MQTT servers that allow you to write hooks for your own code.