grafana / mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Apache License 2.0
168 stars 49 forks source link

No data in mqtt #96

Closed astrakid closed 3 weeks ago

astrakid commented 4 months ago

hi, i am using grafana latest version in docker container and the latest mqtt-plugin. my mqtt-publisher is mosquitto in another docker container. mqtt is fully functional (other containers are publishing data to mosquitto and others are subscribed t mosquitto successfully). in grafana i am not able to get data from mqtt, although the test is succesful and i see a connections in mosquitto when connection is tested in grafana.

image

i tested several topics, from # mbmd/# mbmd/sunspec1-126/# mbmd/sunspec1-126/Frequency mbmd/sunspec1-126/Frequency/#

nothing is giving me any data.

i verified the connection several times, it loogs good:

image

any ideas?

regards, andre

teefixx commented 3 months ago

Hi all, I face the same problem a FlashMQ server from VenusOS. Other clients incl python can read and write, this plugin just gets no data at all...

astrakid commented 3 months ago

at least i was able to receive data, but only when having timewindow set to current timeframe. my default view is covering the whole day (forecast data is included), then i don't receive anything. very annoying.

MrG8N commented 2 months ago

I have the similar problem. I get allways 0 data. But with MQTT Explorer and connection test all works fine. I try a Flash MQ Broker and a mosquitto (HomeAssistant) nothing works

SummerSeaSun commented 2 months ago

Same here no data are shown. Attached output from Inspect: Query:

{
  "request": {
    "url": "api/ds/query?ds_type=grafana-mqtt-datasource&requestId=Q111",
    "method": "POST",
    "data": {
      "queries": [
        {
          "datasource": {
            "type": "grafana-mqtt-datasource",
            "uid": "adkz30u2cge80d"
          },
          "hide": false,
          "refId": "B",
          "topic": "tb_temp/status/switch:0",
          "datasourceId": 1,
          "intervalMs": 30000,
          "maxDataPoints": 739
        }
      ],
      "from": "1715052995577",
      "to": "1715074595577"
    },
    "hideFromInspector": false
  },
  "response": {
    "results": {
      "B": {
        "status": 200,
        "frames": [
          {
            "schema": {
              "refId": "B",
              "meta": {
                "typeVersion": [
                  0,
                  0
                ],
                "channel": "ds/adkz30u2cge80d/30s/tb_temp/status/switch:0"
              },
              "fields": []
            },
            "data": {
              "values": []
            }
          }
        ],
        "refId": "B"
      }
    }
  }
}

image

EDIT

I've tried with "#" topic and data are coming, it seems that data need tranformation as described here: https://community.grafana.com/t/mqtt-chart-demo/120121

astrakid commented 1 month ago

i think i have found the solution. when using a low interval i am getting values. to reach this approach you have to set max data points to a higher value (for my timeframe now/d+5h up to now/d-90m i need to set up 20000 max data points).

frankvandenhurk commented 3 weeks ago

It seems that it is also possible to set "Relative time" to a low value (in my case 1 minute). With the added benefit of the "live data" experience, since the Stat visualisation showes the values from the last minute in a very nice way (my source updates about every 2 seconds).

astrakid commented 3 weeks ago

that method is even smarter than my previously mentioned way. thanks for that!

astrakid commented 3 weeks ago

use relative time is a smart method