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

No data in mqtt

Open astrakid opened this issue 11 months ago • 4 comments

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

astrakid avatar Mar 08 '24 14:03 astrakid

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...

teefixx avatar Apr 07 '24 14:04 teefixx

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.

astrakid avatar Apr 08 '24 06:04 astrakid

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

MrG8N avatar Apr 24 '24 10:04 MrG8N

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

SummerSeaSun avatar May 07 '24 09:05 SummerSeaSun

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).

astrakid avatar May 29 '24 10:05 astrakid

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).

frankvandenhurk avatar Jun 13 '24 04:06 frankvandenhurk

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

astrakid avatar Jun 13 '24 18:06 astrakid

use relative time is a smart method

astrakid avatar Jun 13 '24 18:06 astrakid