Instead of publishing something like emon/emontx4/P1, we could publish this way emon/emontx4/power/P1, same for voltage, …
Would it be compatible with emoncms ?
“Pulse” would be in the same sub-topic as “E1…”. So emon/emontx4/energy/pulse
Can you publish the JSON to emon/<device_name> (no data sub topic) - translates better to emoncms. (I think this needs added to the docs).
Also for MQTT, it might be better for the user to specify just the ‘base’ topic (e.g. emon) and then state in the docs what is then added by the component. So it would add device_name - JSON published on this, then device_name/P1 for CT outputs.
I think the option to send JSON, and/or split data would be good.
Perhaps also to override the device_name in the topic as well.
Does the node need to be a number? I think emoncms accepts names as well (need to check that).
Sure, I’ll fixed it.
But we should remember, that this MQTT stuff isn’t exclusively intended for forwarding to emoncms. I see it much more as the new feature, so anybody who runs another system like Jeedom, … will be able to easily integrate OpenEnergyMonitor devices into their system.
My knownledge in “MQTT best practices” are near zero
I can add some more details in the mqtt section, that’s not a problem. We could make it full flexible, trying to not overcomplicate it either.
I though about a sub-topic power, voltage, … because this way, it’s easy to filter out what the user wants. Again, I could define a parameter like “group” or “categorize”, or something like that.
Well, that was the point in fact. Since this component is implemented as a “singleton”, it’s not present or it’s instantiated only once. There is no way to declare multiple brokers.
From there one, there’s no need to specify any mqtt_id.
For http forwarding, it’s the same.
Looking at my emoncms inputs from the MQTT side, definitely want the option to make it JSON (on the base topic) or separate topics . Defaulting to JSON would be my preference. I cannot envisage a situation where both were required (so it does probably exist).