Work around for missing "GROUP BY (month or year)"

I’m desperately looking for ideas how to compensate this missing capability. I’m fully aware of the corresponding feature request #3991, but despite many participants the status is still unknown and I can’t wait any more. BTW I’m using Grafana where I need to use a GROUP BY (month or year),

The best idea for a work around would be to create seperate tags “month” and “year”. I assesst two ways to do it but failed:

  1. create those tags by my client… It’s openHAB and it won’t work. Here is the explanation why not
  2. use CQ to copy the original series and add month and year tags… It’s again won’t work, because I’d need a function like DATEPART in SQLserver or DATE_PART in PostgreSQL. InfluxDB doesn’t have it.

The only solution I currently see is to write my own CQ-like daemon with ie C and use HTTP API to access InfluxDB. It is however a strange solution.

Do you see any other ways ?

I had this same problem. In my case I use a python script to insert my data including the timestamp. So I modified the python script to add a tag for month and day of the week based on the timestamp. The one problem I discovered is that the timestamp is in utc so when you display values grouped by the tag “month”, it is the utc month not the local timezone month, which is 5 hours different for me. I could probably fix this in the python script by using the local time zone timestamp to create the tag, but that means I would need to rewrite all my data.

I am writing energy values from a device called GEM using a script called btmon every 30 seconds.

1 Like