mqtt-datasource icon indicating copy to clipboard operation
mqtt-datasource copied to clipboard

Question: When using a wildcard, how can I split the values

Open Hans-S opened this issue 9 months ago • 2 comments

Good day,

I am using this plugin to display live data. I can get it to display multiple values when the message is json and contains a name/value pair for each metric. However I also tried to subscribe to this:

Home/+/+/+/power/#

Messages contain electric power consumption per device, of example:

Home/fibaro/fibaro/WashingMachine/power/float 35.53 Home/fibaro/fibaro/Freezer/power/float 0.4

However, in a graph these are all displayed as "value", not as separate values per topic. Ideally, I would want to display the values as "WashingMachine" and "Freezer". But complete topic will do also. Might be possible to split that up with a regex or something.

Is there a way to split the values based on the topic name?

Hans-S avatar Feb 19 '25 12:02 Hans-S

This is also an issue for the Sonoff 4-channel devices I'm using as irrigation controllers. The topic irrigation/bees-knees/relay/+ has 0-3 and I'd like to use transformers to show the status of each (and show a name). I'm not able to use separate queries either, as the datasource doesn't pass the query name. All transformers just show a Time and Value field - no Series, etc. is available.

excalq avatar Apr 27 '25 01:04 excalq

Currently the plugin sdk does not allow to return series. I already digged into this and could find a solution. The only thing that can be added, would be the topic to the field name. Should not be that hard. If someone implements that, making this an opt in option in the query editor might be nessecary to avoid breaking changes.

Nocccer avatar May 05 '25 17:05 Nocccer