Creating Grafana Annotations with InfluxDb

Hi there.

I’ve created a Grafana graph showing soil moisture and soil temperature for my new Thuja hedge. See attached image:

hedgegraph

You might have noticed that I started irrigation this morning by the rise of the yellow line.

Now, I’d like to automatically add an annotation to the graph showing whenever irrigation starts. I have an openHAB controlled magnetic valve named “Wall_Plug_Irrogation”. It is persisted into influxDb so I was hoping to be able to use that data.

I’m not sure how to define the annotation though but I guess it’s probably very easy.

The official Grafana documentation for annotations with InfluxDb isn’t enough to make me understand how to do it using a persisted openHAB item as source.

As you can see in the image below, I’ve tried with the following SQL statement:

SELECT "Irrigation" AS title, "Hello" AS tags, "New water has arrived" AS text from  "Wall_Plug_Irrogation" WHERE value = 1 and $timeFilter

It doesn’t work though, I can’t see why and there are no error messages as far as I am aware of.

Any ideas? Thanks!

EDIT: I made some progress by removing the use of selecting constants as columns. (Maybe that’s not supported in influxdb?) Now I can see the annotations but they have no text or titles of course.

Current SQL stement:

SELECT * from  "Wall_Plug_Irrogation" WHERE value = 1 and $timeFilter

Now I have the red annotation line.
annotations2

Remains to figure out how to add a Text and Title to the annotations.

5 Likes