Grafana dashboard with direct access to emonCMS data

Hello all, I’m here to share with you how configure grafana to direct access to emoncms data. For this you need to use MARCUSOLSSON-JSON-DATASOURCE with this configuration:


Value of Header Authorization = Bearer APIKEY.

Next step, config your panel:
image
with params:
image
where id is feed id in emoncms.
sorry for my english. :slight_smile:

1 Like

and we get grafana dashboard

For get list of the feeds we need add new data source:

and config panel as table:

For get last value of the feed, we need add new data source:


and config panel as gauge:

with params:

2 Likes

Nicely done. thumbsup

1 Like

Thanks for sharing @Oleg that’s great!

Hallo Oleg
many thanks for sharing this. I tried to replicate what you did with for “timevalue” data but unfortunately without success. I can read the “timevalue” data via Postman from EMONCMS. but Grafana does not seem to get any data. I do not get any errors either.

Do you maybe have a more detailed description what you did to:

  1. get the Bearer APIKEY - I must assume this is something different then the “normal” API read api-key shown in the EMONCMS GUI?

  2. add a panel - e.g. did you add anything other tabs then “Fields” and “Params” - especially in the “Path” tab to define the data to be pulled?

Many thanks

Fredi


all good now - Fredi

Hi Fredi,

What did you have to do to fix it?

Sharing that info might help other users who have the same or similar problem.

Thanks!

I did not correctly read/understand the comment about the “Authorization” Header value: Bearer APIKEY
APIKEY needs to be replaced by the Read API Key numeric value which you find in EMONCMS under “My Account”. I guess this is pretty straight forward it you know what you are doing :wink:
The EMONCMS API descriptions helped me to better understand what this stands for.
Other than that I just followed Oleg’s description.
Really great how everything works together - EMON is just a perfect system

Many thanks

Fredi

BTW - I am running the open-source version of Grafana instance for Raspberry PI installation: Install Grafana on Raspberry Pi | Grafana Labs

You might want to have a look at this thread:

Thanks for posting the solution.

thumbsup

Hello all,
I am trying to replicate what Oleg did, unsuccessfully.
Timevalue, current value nor list are showing any data.
I am able to create the data sources. Below 3 screenshots:

  • Data Source settings
  • Panel Settings
  • browser output (JSON) from API



Any ideas?

PS: I just uploaded the one regarding the list, hoping that by solving this one, the others (time value and current value) will be also solved.

I didn’t have any success trying to load the data using JSON directlly but have got it to work via mqtt and node-red, using the influxdb node..
Briefly - in node-red - I pickup the data using mqtt in and pass it to the influxdb node via a simple function. The influxdb node then sends the data to influxdb that can analyse/plot or be used by Grafana.
I found using influxdb was useful because once you see data coming in, it is straightforward to send the data to Grafana. However finding the right combination of tokens etc in both programs was frustrating - especially as they seemed different in every new version.
Once Grafana was able to connect to influx (running on another rPi) then plotting the data was mostly straightforward using cut and paste flux commands.

But it’s been running now a few weeks and seems stable and informative.
Here are some screenshots.
From Node-red:

From influxdb:


From Grafana (using influxdb):

My Node-red implementation is not optimised in that I am using a separate input for each MQTT topic and then summing them all into influxdb. I think there is a batch input, but I’ve not had any problems without it.

I also have another influx database for a 16 cell battery and use Grafana for that as well - after some struggles getting the batteryy BMS to provide data to a python script…