Autor Thema: 24-hour average  (Gelesen 1074 mal)

Offline Mario

  • New Member
  • *
  • Beiträge: 6
24-hour average
« am: 17 Mai 2017, 11:09:15 »
Hello, it is possible to calculate 24-hour average with fhem and/or helper module ?

fhem average helper calculate "current day" average which means it has limited accuracy by most of a day
=> and is almost correct only about 1 sec before midnight ;-)

found also
which mislead to be avergaing for given time but only uses 25 for sample buffer so it is way off for update rates greater then one per hour,
(it result with ~4 minutes average for 10 sec sampling period for requested 86400 s average)
(not sure about load/performance effect after hacking to use needed 1440 sample buffer)

Offline fruit

  • Full Member
  • ***
  • Beiträge: 289
Antw:24-hour average
« Antwort #1 am: 17 Mai 2017, 21:59:46 »
If you are wanting a list of daily averages you could grab and save that value just before midnight each day.

There is also a useful utility myDiff, see and there is an example of calculating rainfall over 24 hours, RegenmengeLast24Hours

The myDiff utility should be placed in, if you are not sure about that may help
Feel free to follow up in German if you prefer

Offline mumpitzstuff

  • Developer
  • Sr. Member
  • ****
  • Beiträge: 901
Antw:24-hour average
« Antwort #2 am: 17 Mai 2017, 23:49:51 »
Search for event-aggregator within the Fhem command ref.

attr mySunMeter event-aggregator SUN_INTENSITY_24H::const:integral:86400

Offline Frank_Huber

  • Hero Member
  • *****
  • Beiträge: 2007
Antw:24-hour average
« Antwort #3 am: 18 Mai 2017, 10:13:42 »

I do it that was wit a "at" timer and write teh average outside temperature into a dummy named "Verbrauch" into Reading "Durchschnittstemperatur.
to calculate I also use the average helper module inside my device "Aussen_Temp".

define Durchschnittstemperatur_Tag at *23:59:30 {\
my $wert1=ReadingsVal("Aussen_Temp","temperature_avg_day","--");;\
fhem("setreading Verbrauch Durchschnittstemperatur $wert1");;\