24-hour average

Begonnen von Mario, 17 Mai 2017, 11:09:15

Vorheriges Thema - Nächstes Thema

Mario

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 https://wiki.fhem.de/wiki/Gleitende_Mittelwerte_berechnen_und_loggen
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)

FHEM since 2013, mixed FS20, HmIP, HM,
own modules for heater, garden & wheater station,
sun intensity, rain ratio & soil humidity sensors for inteligent watering.

fruit

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 https://wiki.fhem.de/wiki/HM-WDS100-C6-O_Funk-Kombi-Sensor_OC3 and there is an example of calculating rainfall over 24 hours, RegenmengeLast24Hours

The myDiff utility should be placed in 99_myUtils.pm, if you are not sure about that http://www.ply.me.uk/bits_and_pieces/fhem_snippets.html may help
Feel free to follow up in German if you prefer

mumpitzstuff

Search for event-aggregator within the Fhem command ref.

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

Frank_Huber

Hi,

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");;\
}


br
Frank