I'm prototyping using Node Red to publish device statistics (OS, Memory, CPU, etc) into a MQTT broker to later use the info for a dashboard. I had it working fine but now I'm trying to generalize it as much as possible to be portable to other devices.
Currently I'm setting the topic root using an inject node, but then need to append the specific OS node info to the end. For some reason whatever I specify is getting appended twice instead of once.
I'm passing the base topic in like this:
And then trying to append the node specific part of the topic here:
With the result snn/mem/device/rhel/os/os
Is this a bug or a node red quirk?
Here's a partial of the flow. I haven't updated the other nodes yet until I get this working:
[{"id":"b10ff2498aaeb5f0","type":"OS","z":"8a41767628f10399","name":"","x":410,"y":40,"wires":[["f989c896d144302a"]]},{"id":"7af0f4f5f9b1996a","type":"inject","z":"8a41767628f10399","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"snn/mem/device/rhel","x":140,"y":120,"wires":[["b10ff2498aaeb5f0","155b7c67b45de8cf","8f52460ef9fac9d2","927f702bae5530c8","1589319ae8f25a97"]]},{"id":"f989c896d144302a","type":"change","z":"8a41767628f10399","name":"OS Topic","rules":[{"t":"change","p":"topic","pt":"msg","from":"(.*)","fromt":"re","to":"$1/os","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":40,"wires":[["1b76fb93117376c6"]]},{"id":"1b76fb93117376c6","type":"debug","z":"8a41767628f10399","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":40,"wires":[]}]