mqtt2prometheus icon indicating copy to clipboard operation
mqtt2prometheus copied to clipboard

Help wanted related to shelly1 with temperature module

Open fenrus opened this issue 3 years ago • 1 comments

Hi,

I've been looking at your project, and it's looking great!

I'm currently pulling temperature values from Shelly1 hardware with temperature module. The hardware module can have up to three temp sensors attached.

I've implemented it as three separate metrics, because i have yet to figure out how to put it all in the same one. (Is this possible?)

The documentation for this hardware and module can be found here: https://shelly-api-docs.shelly.cloud/gen1/#shelly1-1pm-mqtt

here's some JSON example data on the topic "shellies/shelly1-C45BBE77777B/ext_temperatures" is this:

{
  "0": {
    "hwID": "28f7f676e0000000",
    "tC": 25.9
  },
  "1": {
    "hwID": "28f7f676e0011111",
    "tC": 15.9
  },
  "2": {
    "hwID": "28f7f676e0022222",
    "tC": 6.9
  }
}

The config i'm using is roughly this:

mqtt:
  topic_path: shellies/+/ext_temperatures
  device_id_regex: "shellies/(?P<deviceid>.*)/ext_temperatures"

metrics:
  - prom_name: shelly_temperature_0
    mqtt_name: 0.tC
    help: shelly temperature reading
    type: gauge
    const_labels:
      sensor_type: shelly

Metrics are repeated prom_names "shelly_temperature_1 and 2, as well as mqtt_names: 1.tC and 2.tC

I'm greatful for any assistance.

fenrus avatar Feb 17 '22 21:02 fenrus

The current data processing model of mqtt2prometheus doesn't allow to extract multiple instances of the same time series from the same mqtt event 🤔

I think with the implementation of #74 one could consider to implement something like this. Meanwhile one could try to change the __name__ label during relabeling in Prometheus.

hikhvar avatar Feb 19 '22 10:02 hikhvar