Group by time (month) depending on selected timespan

Hi everyone,
I want to visualize my energy consumption using grafana - works fine so far. I use the JSON Plugin to get the data from my home automation system.

I have one panel where I select different timespans (last 24 hours, last 7 days, last 30 days, last year). I would like to group my data by time depending on the selected timespan:

Last 24 hours → group by hour (works automatically out of the box)

Last 7 days → group by day (works automatically out of the box)

Last 30 days → group by day (works automatically out of the box)

Last year → group by month → does not work (see attached screenshot)

How can I achieve my aim? In my mind it is not an option to group in the query itself, because the “aggregation level” differs depending on the selected timespan, but the query is static for the complete panel, right?

Best Regards!

Welcome

What is your data source?

Thank you! Sorry - hope I got the question right - I use the JSON Plugin (link in my post above) as my data source.

1 Like

No need to apologize.

Please provide sample json?

Does this sample data help?

Data String:{“target”:" Außen",“datapoints”:[[77.246,1642978800000],[85.445000000001,1643583600000],[125.913,1644188400000],[96.466,1644793200000],[211.673,1645398000000],[77.125,1646002800000],[81.123,1646607600000],[96.353,1647212400000],[112.241,1647817200000],[52.893,1648418400000],[74.959000000001,1649023200000],[137.567,1649628000000],[143.272,1650232800000],[109.07,1650837600000],[56.35,1651442400000],[62.295999999999,1652047200000],[41.388,1652652000000],[32.524,1653256800000],[80.398,1653861600000],[58.509,1654466400000],[81.864,1655071200000],[109.121,1655676000000],[99.285,1656280800000],[126.962,1656885600000],[83.13,1657490400000],[34.61,1658095200000],[33.542,1658700000000],[76.007,1659304800000],[132.71,1659909600000],[36.955,1660514400000],[82.919,1661119200000],[85.152,1661724000000],[97.969,1662328800000],[60.373000000001,1662933600000],[66.78,1663538400000],[162.659,1664143200000],[45.764,1664748000000],[44.659000000001,1665352800000],[40.777,1665957600000],[13.032999999999,1666562400000],[12.22,1667170800000],[9.567,1667775600000],[20.93,1668380400000],[72.160999999999,1668985200000],[59.545,1669590000000],[56.637000000001,1670194800000],[72.887,1670799600000],[98.704,1671404400000],[41.630999999999,1672009200000],[31.17,1672614000000],[73.205,1673218800000],[41.996000000001,1673823600000]]},

1 Like

Hi everyone,
any update on that issue? Can I provide more information / input? Still no solution on that from my side - already tested another JSON datasource plugin in grafana, but ended up with the same result.

Best Regards!