kpetremann / mqtt-exporter

Simple generic MQTT Prometheus exporter for IoT working out of the box
https://hub.docker.com/r/kpetrem/mqtt-exporter
MIT License
103 stars 29 forks source link

Doesn't support Shelly 3EM format very well #36

Closed OdyX closed 1 year ago

OdyX commented 1 year ago

Hello there,

my understanding from trying to use this to push 6 different power measurements from 2 Shelly 3EM devices, is that there's no way to either sum, or differentiate the three phases' measurements.

This is what one Shelly 3EM sends as MQTT topics:

shellies/shelly-deviceid1234/emeter/0/power
shellies/shelly-deviceid1234/emeter/0/pf
shellies/shelly-deviceid1234/emeter/0/current
shellies/shelly-deviceid1234/emeter/0/voltage
shellies/shelly-deviceid1234/emeter/0/total
shellies/shelly-deviceid1234/emeter/0/total_returned
shellies/shelly-deviceid1234/emeter/1/power
shellies/shelly-deviceid1234/emeter/1/pf
shellies/shelly-deviceid1234/emeter/1/current
shellies/shelly-deviceid1234/emeter/1/voltage
shellies/shelly-deviceid1234/emeter/1/total
shellies/shelly-deviceid1234/emeter/1/total_returned
shellies/shelly-deviceid1234/emeter/2/power
shellies/shelly-deviceid1234/emeter/2/pf
shellies/shelly-deviceid1234/emeter/2/current
shellies/shelly-deviceid1234/emeter/2/voltage
shellies/shelly-deviceid1234/emeter/2/total
shellies/shelly-deviceid1234/emeter/2/total_returned

As you can see, it reports 3 different e(nergy)meters, each with separate power, power factor (pf), current, voltage, and total energy, and total energy returned.

I haven't found a way to report on those separately, and as of now, only get a single mqtt_total that only contains the latter value.

Is there a way to configure mqtt-explorer to report on these separately? Or could this be allowed with a new configuration setting?

kpetremann commented 1 year ago

hello @OdyX,

Shelly 3EM are not officially supported - simply because I don't have any - only Shelly H&M is.

However, please provide the current metrics you get so I can understand the issue.

Thanks

kpetremann commented 1 year ago

Ok got it, I ran a quick test with your value, I see the problem.

In the meantime, if the sensor has an Admin page, could you please check if there is a way to change the MQTT topic format. I think it is the case for Shelly H&T sensors (I'll check on my side).

kpetremann commented 1 year ago

is it better with #37 please?

OdyX commented 1 year ago

Yes. Much better, it works perfectly!

Thanks!

kpetremann commented 1 year ago

You are welcome :)

Merged in v1.0.3