Hello,
I’m using Grafana to visualize data readings from my climate sensors (temp/hum/pres etc).
Data from sensors is collected by HomeAssistant and stored into Influxdb which is datasource for Grafana.
My graphs (for example) looks as follows:
I would like to add sun state to this type of graph (to visualize sunset/sunrise influence on temperatures and heating system)
I set up sending information about sunrise and sunset from HomeAssistant as a additional custom “sensor”. As a result I receive: value "UP"
on exact sunrise time AND value "DOWN"
on exact sunset time.
So… I have additional value which can be presented on the graph.
How can I visualize nicely sun state together with my temperature timeseries graphs?? (as a additional “value”) ??
Greetings, M
Hi,
Maybe using influxdb annotation query? Does only support showing an annotation on the exact time for up/down though.
Marcus
Well… looks really interesting!
Thank you for hint
Greetings, M.
I tried to use annotations query with success… unfortunately it looks like that the standard HomeAssistant sensors responsible for sunset / sunrise information providing multiple results which is problematic for grafana annotations mechanism.
However… I can receive exact time of the sunset and sunrise using one query:
> select state FROM state WHERE entity_id = 'sunrise' ORDER BY ASC LIMIT 1
name: state
time state
---- -----
2018-02-18T23:36:37.828545024Z 06:44
But how can I transform this query to the form which can be used in grafana annotation?
I mean:
time state
---- -----
06:44 sunrise
Any ideas?
I see. I have no experience using HomeAssistant. But looking at the HomeAssistant influxdb documentation the section regarding tags_attributes looks interesting. Don’t know if that configuration can help you.
Otherwise, you may be able to create native annotations using the http api?
Marcus
Hello,
I’m still working on solution of using annotations for my graphs.
At the moment I shifted into idea of using “simple-json” as datasource for external API (darksky) which offers sunset, sunrise times.
I setup simple-json datasource plugin successfully (Save&Test is OK).
However when I’m trying to setup simple-json on my graphs I have an following error (query inspector output):
xhrStatus:"complete"
request:Object
method:"POST"
url:"api/datasources/proxy/3/search"
data:Object
target:""
withCredentials:undefined
response:"Cannot POST /url/to/endpoint"
It looks like that API of my external service (darksky) didn’t offer POST (only GETs are supported).
My question is: how to switch method of simple-json to GET queries ?
Greetings, M.
Hi,
I think you misunderstood how to use that plugin. Please see my comment here Grafana simplejson dashboard
Marcus
Hello,
Really? I looked on comment which you suggested,
I trying to use json-datasource plugin to collect specific data.
Take a look:
I’d like to you this particular data for annotations… Any clues how to use it?
Greetings, M.
What I mean is that you have to implement your own REST API endpoints that conforms to the request/response that simplejson plugin expects. In your REST API you’ll request data from your external api, in this case darksky, and convert the response so that simplejson understands it.
Marcus