Grafana and Thingspeak API

45 views (last 30 days)
pravin vaz
pravin vaz on 1 Feb 2021
Hi all
I am trying to use Grafana dashboard to show my Thingspeak data which is generated by a Microbit IoT device. The data logs perfectly to the thingspeak website, and the GET command works fine as I copied and pasted into a new browser and i got json data (channel is public).
However, when I try connect my grafana dashboard and add the JSON channel feed (through simple JSON a plugin), I get a error in Grafana (although it says connection established). The error is:
<!DOCTYPE html> <html> <head> <title>We're sorry, but something went wrong (404)</title> <style type="text/css"> body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } div.dialog { margin: 3em auto 0 auto; } h1 { font-size: 100%; color: #f00; line-height: 1.5em; } </style> </head> <body> <!-- This file lives in public/404.html --> <div style="padding-top: 50px"> <img src='/thingspeak_logo_white.png' width='200' height='35' style='background-color: #2f7eb2; padding: 10px;' /></div> <div class="dialog"> <h1>The page you were looking for doesn't exist.</h1> <p>You may have mistyped the address or the page may have moved.</p> </div> </body> </html>
I am using a windows machine.
Regards

Accepted Answer

Vinod
Vinod on 1 Feb 2021
I have this set up like this and it works:
1) Set up the datasource. In my case, I set up a new JSON API with this URL: https://api.thingspeak.com/channels/12397/fields/1.json
2) Next I created a new dashboard with the above datasource, the "Query string" set to "results=8000" and 2 queries
a) $.feeds[*].created_at
b) $.feeds[*].field1
Now I select a graph visualization and get this dashboard:
This is no different than the chart here:
So, can you provide more context on your use case for Grafana instead of the built in charts?
  3 Comments
Vinod
Vinod on 2 Feb 2021
Edited: Vinod on 2 Feb 2021
I did not create variables, but I did pick the datatype for the queries. Take a look at my screenshot for details.
pravin vaz
pravin vaz on 2 Feb 2021
Thanks mate. That worked like a charm.

Sign in to comment.

More Answers (2)

Sriramajeyam Sugumaran
Sriramajeyam Sugumaran on 18 Feb 2021
You can use Grafana Infinity Datasource for this purpose. Below screenshot is an example from https://thingspeak.com/channels/1103934/ and how to use it. This plugin also allows you to other formats like csv/json.
PS: I am the author of the grafana infinity datasource plugin
  1 Comment
j wright
j wright on 14 Mar 2022
hi thanks for making such a great plugin! I had my data up and displayed in grafana in no time! i am wondering if you can help as I am only recieving 26-27 minutes worth of data displaying in grafana?
Is this to do with thingspeak only sending 100 lines at a time?
What do i need to do to be able to see more historical data than 26 mins ago?
All help appreciated
Thanks

Sign in to comment.


Jacques van der Mescht
Jacques van der Mescht on 1 Mar 2023
I know it is an old thread, but I am also having an issue of only getting a limited amount of history data. I record data every minute and can only get/view data in Grafana for about 6 days which is 8000 points and the thingspeak server limit. Is there not a way to not read the last 8000 points, but say 8000 points in a specific period of a year ago. Or even read batches of 8000 points to make up the history range I need? Grafana works perfect to view the data, but the limit of 8000 points is a problem. Or is there another program to visualize more than 8000 points? Thanks Jacques

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on ThingSpeak in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!