Reset total/Daily total?


I would like to calculate (and show) the daily amount of water being used in our household. What’s the best way to tackle this? The water meter counts the total m3 water. Should I create a new variable that counts and resets this value ever 24 hours?



Its enough to change the type of aggregation from standard to counter

Best regards

That looks like it should do what I want, but the only compaction values I can choose are minute, 5 minutes and hour. That doesn’t provide a „daily“ counter, or am I missing something?


You need to switch from standard to counter.

Comapact or shrink the data is to decrease the amount of data. For example, you get every seconds new data, you can shrink them to one value every minute or one value every 5min.


I did change the archive setting from standard to counter, but that does exactly nothing.


you could do it with a script, I stole the code from @KaiS Energierechner Module, so we need to thank him :smiley:

Start the script with every change of your water variable and myabe you need to set the new daily var to 0 every day at 00:01.


//Start writing your code here

$start=strtotime('today 00:00');

function calculate($startDate, $endDate, $aggregationTyp = 0)
    $archiveID=15374;//ID Archive
    $consumptionVariableID=24612; //ID basis var
    $values = AC_GetAggregatedValues($archiveID, $consumptionVariableID, $aggregationTyp, $startDate, $endDate, 0);
    $consumption = 0;
    $tmpValueAVG = 0;
    foreach ($values as $key => $value) {
       $tmpValueAVG = $value['Avg'];
       $consumption += $tmpValueAVG;
    return $consumption;

you do not see the effect in the logged values you must look at aggregated values or even better the graphics in the web front after a few days. It starts every night with 0 and then it increases the counter until next night. After a few days you will have for instance:

24, 23, 26, 20 as a result. The logged values will stay original.


Ah, I see. So if I want a „real-time value“ shown in Webfront I need to look for a solution like @bgersmann suggested.

Which variables should I use for the following:
$archiveID=15374;//ID Archive
$consumptionVariableID=24612; //ID basis var

43631 is a new float for the daily value.
15374 is the one of the archive module.
24612 is the original variable you get your values from (total m3 water).

Thanks @bgersmann,

It’s working now:

1 „Gefällt mir“