i have a database who contain a lecture of the instant watt consumption of my house. Every 10 sec the device read the real consumption and save it in the database. I like to extract haw many watt i consume in thi day in this week and this month.
The data is locate here: W,domain=sensor,entity_id=potenza_reale
Can you help me with the influxdb string for extract this data?
I think you can sum your values over an hour and divide by the number of 10s intervals in an hour to get kWh. Then you can just add these up over whatever interval to get the result in kWh/interval. Let me know if it works, as I’m unsure it is correct:
1 day:
select sum(*) from (select sum("value") / 3600 from watts group by time(1h)) group by time(1d);
7 day:
select sum(*) from (select sum("value") / 3600 from watts group by time(1h)) group by time(7d);
Ok in this way is ok, but if the controller some times don’t send the value this is missing. Can I divide instead of 3600 by the exact number of received value?