Open NiklasCi opened 4 months ago
can it work with plugin like htmlgraphic https://grafana.com/grafana/plugins/gapit-htmlgraphics-panel/
https://grafana.com/grafana/plugins/gapit-htmlgraphics-panel/
If this plugin supports getting the backend server and the access to the grafana api sure. You can send a query via grafana datasource api: https://grafana.com/docs/grafana/latest/developers/http_api/data_source/#query-a-data-source
Should look like this:
POST /api/ds/query HTTP/1.1
Accept: application/json
Content-Type: application/json
{
"queries":[
{
"refId":"1",
"datasource":{
"uid":"MQTT-UID" // need to be known
},
"topic": "cmd/send/values",
"payload": {
"value1": "Hallo",
"value2": 12.34
},
"response": "response/from/send"
}
],
}
Thanks. I'm not that expert on this stuff, so I need to study all this more in details. But the html graphic panel allow you to write in javascript, so I think it should works, shouldn't it?
Thanks. I'm not that expert on this stuff, so I need to study all this more in details. But the html graphic panel allow you to write in javascript, so I think it should works, shouldn't it?
Yes as long as you get the backend server. There are helper functions under @grafana/runtime
.
For example getDataSourceSrv()
or getbackendSrv()
. Maybe cehckout iof you can access them in the html panel.
If so you can publish mqtt data.
Thanks so much. I'll give it a look
This PR adds support to publish data via the datasource by sending a different payload. This can be used by plugins like Buttons Panel or Data Manipulation.
Publish timeouts after 1s and subscribe timeouts 1s after publish was successful.
Schema of query:
Example of a query:
The returned response from the query contains the reponse of the mqtt command under a new frame with name
Response
and a fieldBody
where the field values contain the responded message. Note: I only tested json response messages.Blocked by: #91