MQTT Proxy to modify topics

Instead of NodeRed - what are your thoughts @glyn.hudson Glyn on a ‘Modifying MQTT Proxy’ - as light-weight way to get Shelly data to emon (ie avoiding the need for NodeRed altogether: so could be light enough code to run on emonPi hardware. And seems more efficient than EmonPi duplicating the MQTT data for the shelly data twice: once pre and once post-NR ?

Actually there are loads on GitHub - here’s the first one I found: you may know of better ones

Quoting from: GitHub - phoenix-mstu/janus-mqtt-proxy: MITM proxy which can filter and modify MQTT packets

Modifying MQTT proxy

With this service you can transform MQTT topics and their payload by specifying transformation rules.

For example you have topics /some/topic1 and /some/another/topic2 on MQTT broker, and you have a client which needs them to be /root/topic1 and /root/topic2.

That looks like a great option, I’m not familiar with MQTT proxy. Any idea what template would be required to convert:

topic: shelly/status/temperature:0 payload: {"id":0, "tC":23.1, "tF":73.6}

to

topic: emon/shelly/indoor payload: 23.1

There doesn’t seem to be much documentation on how the template transformations work.

It seems to work fine to me. I think the display issues have been fixed with FW update. I’m only really bothered about temperature readings. Humidity measurements are not usually as accurate as temperature.

@glyn.hudson

My MQTT knowledge is very limited. And I’ve not used this proxy. It was just the concept of converting ‘on the fly’ as a proxy that sounded cool.
That GitHub project is I notice from a Russian guy - not sure if that changes my view on whether I’d want to use it personally, or not.

Anyway, his complex yaml file shows loads of conversions>

and his medium article explains the big picture