Annotations API - question on tags

I am using Influxdb + Grafana for viewing my SmartThings data. Power usage, thermostats, temps, etc.

I have an automated routine set up in WebCore that creates a region annotation through the Grafana API when the house is unoccupied so I can see if we leave doors open, lights on, etc. when no one is home. This works great. Payload that gets sent is

{“dashboardId”:2,“isRegion”:true,“text”:“This is a test”,“panelId”:1,“time”:1516898058051,“timeEnd”:1516898658060}

What I cannot do, through limitations in webCore, is add tags to the annotations. I have no way of adding a bracketed value list to the API call. “tags”:[“Occupancy”].

If I add a variable with the value [“Occupancy”] it gets wrapped in extra quotes and the internal double quotes get escaped, and Grafana chokes on it.

{“dashboardId”:2,“isRegion”:true,“text”:“House is Unoccupied”,“panelId”:1,“time”:1516882800,“timeEnd”:1516883200,“tags”:"[“Occupancy”]"}

If I try to send a single annotation “tags”:“Occupancy” the call fails on the Grafana side.

{“dashboardId”:2,“isRegion”:true,“text”:“This is a test”,“panelId”:1,“time”:1516897200581,“timeEnd”:1516897800590,“tags”:“Occupancy”}

[{“classification”:“DeserializationError”,“message”:“json: cannot unmarshal string into Go struct field PostAnnotationsCmd.tags of type []string”}]

Is there any way to get Grafana to accept a single annotation tag that is not wrapped in brackets?

Thanks in advance-
milhouse

Hi,

No, there’s no way to get Grafana to accept a single annotation tag that is not wrapped in brackets. I suggest you try to investigate if this is something that WebCore can implement support for.

Good luck

Marcus