I currently use the following query to get the kwh drawn from the grid for this year:
sum_over_time( (sum_over_time(wattage_v1[1m])*360/1000/count_over_time(wattage_v1[1m]))[1y:1h] )
EDIT: This query seems to deliver basically the same result:
sum_over_time(wattage_v1[1y:1h])*360/1000
The metric wattage_v1 provides wattage¹ readings every 15s to 1m.
The query above seems to work. Now I would like to have a similar query which only sums the wattage value if it is above a threshold - say 4000w. I want to roughly estimate the (yearly) consumption of a big consumer that is only running from time to time.
¹ actually 1/360 watt
Thanks
EDIT: I have noticed that the graph doesn't increase monotonic if the range (1y from above set to 1d for example) is smaller than the actual data that is present. I would like to have a counter for the kwh consumed since the beginning of the year or for the selected time range.