oh and I forgot about this thread, but for those interested, I have figured out a basic dashboard in grafana which is discussed in this thread. I have included a link to a blogpost on it and the json to import the dashboard into your own grafana instance.
Totally forgot this thread, I solved my issues using the “last” instead of “mean” value in the grafana query. Now I have exact values in my graphs for everyday/week or whatever consumption
Also I have singlestat meters that reset for every day using “difference” and “last” also
Hi, I’m a new influxdb/grafana user. I setup daily bar graph for energy consumption and i noticed that bars are resetting at utc time an not at local 00:00. How did you manage this issue (if you did it)?
Ok, i solved daily bar charts adding GROUP BY “time(24h,22h)”, but i have no idea how to have a monthly bar chart… I think that a GROUP BY “time(30d)” doesn’t do the job…
Do you use monthly bars? How?
So I use a GROUP BY 1D. if I set it to 30D it looks mostly right, but not every month is 30 days and when I was trying i couldn’t find a good way to do months.
This is my kWh per day (just change the 1d to 30d). I am coming from an IoTWatt on this counter, but also convert stuff from AEOTEC devices as well as Tasmota flashed devices.
SELECT integral("Watts",1000h) FROM "iotawatt" WHERE ("ct" = 'Main') AND $timeFilter GROUP BY time(1d) fill(null) tz('America/Los_Angeles')
Influx 1.x doesnt support grouping by month, I also use “30d” for the time being. However, influx 2.0 should have support for it. I havent dared to upgrade yet but its on my todo-list.
Grafana is great, the update to latest version gives you some new stuff also
Completely off topic but has anyone managed to upgrade their inflyx 1.x to 2.x? Doesnt seem to be so straigjt forward.
Or as a workaround. Is it possible to gran The data from The new enerfy dashboard to influx? That Would soöve The monthly bar problem Instead of using 30 days
To compare the energy usage for multiple month over multiple years, I use this query in Grafana. I use MariaDB in Homeasssistant
SELECT substring(from_unixtime(statistics.created_ts),6, 2) AS month,
MAX(CASE WHEN (substring(from_unixtime(statistics.created_ts),1, 4)) = '2022' AND substring(from_unixtime(statistics.created_ts),12, 2) > 0 AND statistics.state >0 THEN statistics.state END) AS '2022',
MAX(CASE WHEN (substring(from_unixtime(statistics.created_ts),1, 4)) = '2023' AND substring(from_unixtime(statistics.created_ts),12, 2) > 0 THEN statistics.state END) AS '2023',
MAX(CASE WHEN (substring(from_unixtime(statistics.created_ts),1, 4)) = '2024' AND substring(from_unixtime(statistics.created_ts),12, 2) > 0 THEN statistics.state END) AS '2024'
from homeassistant.statistics
WHERE statistics.metadata_id = 112
GROUP BY month ORDER BY month;