98_statistics.pm Schaltjahr Problem?

Begonnen von axel.mohnen, 11 März 2016, 08:36:57

Vorheriges Thema - Nächstes Thema

axel.mohnen

Hallo Fhem'ler,

ich benutze jetzt seit April 2015 das Statistics Modul mit dem Attribute "deltaReadings" um meinen kummulierten Monatsstromverbrauch zu "loggen".
Das hat bis jezt auch super gefunzt, aber ab dem 01.03.2016 wurde der Monatswert nicht zurückgesetzt. Das heisst es wird mit dem Februar Verbrauch weiter gerechnet.
Die Frage ist das ein Schaltjahr oder ein allgemeines Februar (28.) Problem?

Kann jemand das Problem bestätigen, habt Ihr das gleiche Problem?

Vielen Dank.

Viele Grüsse
Axel



tupol

Nein. Hat bei mir problemlos funktioniert. Das Reading wurde erzeugt mit dem Datum 2016-02-29 23:59:55

axel.mohnen

Hi Tupol,

Ich habe die Readings jetzt mehrere Tage beobachtet.
Der Tages- und Monatswert vom Reading "statZählerstand-Bezug-Total" werden nicht mehr zurückgesetzt.
Aber auch der Tageswert vom statZählerstand-Bezug-TotalLast zeigt seit Tagen das gleiche "16,17". Siehe Anhang.

Gruss Axel

tupol

#3
poste mal bitte ein list von dem statistics Gerät.

Mit vorherigem attr global showInternalValues 1

axel.mohnen

Hi Tupol,

hier sind beide Listen:
Liste vom Stromzähler
Liste vom Statistics Gerät

List: Stromzähler Device
Internals:
   .lastTimeMomentanleistung 1457951199.60268
   .lastTimeZählerstand-Bezug-Total 1457951199.60268
   .lastTimeZählerstand-Tarif-1-Bezug 1457951199.60268
   .lastTimestatZählerstand-Bezug-Total 1457951199.62731
   CHANGED
   DEF        /dev/ttyUSB1
   DeviceName /dev/ttyUSB1
   FD         13
   NAME       eg.hw.sz.wp
   NR         78
   PARTIAL
   STATE      opened
   TYPE       SMLUSB
   CHANGETIME:
   Helper:
     Dblog:
       Momentanleistung:
         Eg.hw.sz.wp.dblog:
           TIME       1457951199.70637
           VALUE      12.00
       Zählerstand-bezug-total:
         Eg.hw.sz.wp.dblog:
           TIME       1457951199.70637
           VALUE      17903.30
   Readings:
     2016-03-14 11:28:09   Momentanleistung 39.00
     2016-03-14 11:28:09   Zählerstand-Bezug-Total 17903.30
     2016-03-14 11:28:09   Zählerstand-Tarif-1-Bezug 17903.30
     2016-01-04 00:00:37   Zählerstand-Tarif-2-Bezug 180513445472499865253165662208.00
     2016-03-14 11:26:42   statZählerstand-Bezug-Total Hour: 0.01 Day: 519.65 Month: 663.95 Year: 1164.93
     2016-03-14 10:59:55   statZählerstand-Bezug-TotalLast Hour: 0.02 Day: 16.17 Month: 500.98 Year: 1882.30 (since: 2015-03-31 )
     2016-03-14 11:26:31   state           opened
   Helper:
     PARTIAL    1B1B1B0101010176050A2493006200620072630101760101050361865609080535342D4C6E9D010163D6870076050A2493016200620072630701770109080535342D4C6E9D070100620AFFFF7262016508034BA67B77078181C78203FF010101010449534B0177070100000009FF0101010109080535342D4C6E9D0177070100010800FF650000018201621E52FF59000000000AABD3860177070100010801FF0101621E52FF59000000000AABD3860177070100010802FF0101621E52FF59000000000000000001770701000F0700FF0101621B520065000000260177070100150700FF0101621B520065000000010177070100290700FF0101621B5200650000000001770701003D0700FF0101621B520065000000250177070100600505FF0101010165000001820177078181C78205FF010101018302320A306DEA436533165433912ECB32C344AEE93F51DE13BF4F123850A3036E1298F63E46C4E1F6E41552148429EB298901010163E0BD0076050A24930262006200726302017101636C3E001B1B1B1B1A00559B
     _98_statistics eg.hw.sz.wp.stat
Attributes:
   alias      Stromzähler Wärmepumpe
   event-min-interval *:1800
   room       HWR


List Statistics Device
Internals:
   DEF        eg.hw.sz.wp
   DEV_REGEXP eg.hw.sz.wp
   NAME       eg.hw.sz.wp.stat
   NR         88
   NTFY_ORDER 10-eg.hw.sz.wp.stat
   PREFIX     stat
   STATE      Updated stats for: eg.hw.sz.wp
   TYPE       statistics
   Readings:
     2016-03-14 11:26:42   .eg.hw.sz.wp:Zählerstand-Bezug-Total LastValue: 17903.30 ShowDate: 1 DecPlaces: 2
     2016-03-14 11:26:39   monitoredDevicesSMLUSB eg.hw.sz.wp
     2016-03-14 11:26:42   nextPeriodChangeCalc 2016-03-14 11:59:55
     2016-03-14 11:26:42   state           Updated stats for: eg.hw.sz.wp
   Fhem:
     modulVersion $Date: 2015-12-03 18:21:21 +0100 (Thu, 03 Dec 2015) $
Attributes:
   deltaReadings Zählerstand-Bezug-Total

tupol

Gibt es bei Deinem System zum Tageswechsel eine höhere Last, wodurch statistics zu spät aufgerufen wird?

Vielleicht kannst Du mal die Berechnung mit modul verbose 5 loggen. Ich brauche es für 10 s vor Mitternacht bis 1 Minute danach.

Bitte auch ein Update fahren, damit ich das log zuordnen kann.

axel.mohnen

Hier ist mein Log von Mitternacht:

2016.03.14 23:57:06 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.14 23:57:31 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.14 23:57:56 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.14 23:58:21 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.14 23:58:46 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.14 23:59:00 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'eg.hw.srv.backup' received. Device not monitored.
2016.03.14 23:59:00 2: Backup with command: tar -cf - fhem.cfg ./log/fhem.save ./backup ./CHANGED ./configDB.pm ./contrib ./db.conf ./demolog ./docs ./fehm.db ./FHEM ./fhem.cfg ./fhem.cfg.demo ./fhem.db ./fhem.db-shm ./fhem.db-wal ./fhem.pl ./log ./README_DEMO.txt ./restoreDir ./unused ./www |gzip > /home/pi/dlink_nas/fhem/fhem_backup/FHEM-20160314_235900.tar.gz
2016.03.15 00:01:11 1: backup done: FHEM-20160314_235900.tar.gz (34041145 Bytes)
2016.03.15 00:01:11 3: eg.hw.srv.backup.not1 return value:
backup done: FHEM-20160314_235900.tar.gz (34041145 Bytes)
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HM_2C4E49' received. Device not monitored.
2016.03.15 00:01:11 3: CUL_HM set HM_2C4E49 off
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'eg.hw.sd.tim1' received. Device not monitored.
2016.03.15 00:01:11 4: statistics eg.hw.sz.wp.stat: PeriodChange.317 Next period change will be calculated at 2016-03-15 00:59:55
2016.03.15 00:01:11 4: statistics eg.hw.sz.wp.stat: PeriodChange.334 Calculating day change
2016.03.15 00:01:11 4: statistics eg.hw.sz.wp.stat: DoStatisticsAll.367 Doing statistics (period 0) for device 'eg.hw.sz.wp'
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: DoStatistics.418 Assigned reading 'Zählerstand-Bezug-Total' from attribute 'deltaReadings' to statistic type 2.
2016.03.15 00:01:11 4: statistics eg.hw.sz.wp.stat: doStatisticDelta.672 Calculating delta statistics for 'eg.hw.sz.wp:Zählerstand-Bezug-Total = 17911.21'
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: doStatisticDelta.760 Set '.eg.hw.sz.wp:Zählerstand-Bezug-Total'='LastValue: 17911.21 ShowDate: 1 DecPlaces: 2'
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: doStatisticDelta.766 Set 'statZählerstand-Bezug-Total'='Hour: 1.77 Day: 527.56 Month: 671.86 Year: 1172.84'
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: Notify.254 Notifications of myself received.
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'eg.hw.sz.haushalt.stat' received. Device not monitored.
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.15 00:01:11 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HM_2C4E49' received. Device not monitored.
2016.03.15 00:01:36 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.
2016.03.15 00:02:01 5: statistics eg.hw.sz.wp.stat: Notify.261 Notification of 'HMLAN1' received. Device not monitored.

tupol

#7
Ich vermute, es hängt an Deinem Backup. Starte es mal eher oder später aber nicht zum Tageswechsel.

Ansonsten muss ich mir nochmal den Ablauf näher ansehen.

axel.mohnen

Ich habe das Backup jetzt für 23:30 eingeplant.

Im Log kann ich nicht erkennen wo der "statZählerstand-Bezug-TotalLast" aktualisiert wird...

axel.mohnen

Hi Tupol,

die Kalkulation scheint wieder zu funzen
Der Tageswert des Reading "statZählerstand-Bezug-Total" ist OK und der Tageswert vom statZählerstand-Bezug-TotalLast auch.
Jetzt warte ich noch auf den nächsten Monatswechsel....

tupol

Habe eine neue Version hochgespielt, die auch in deinem Fall etwas robuster ist.

axel.mohnen

Super,

ich habe gestern Nacht nochmals den verbose = 5 gesetzt, jetzt kann ich auch sehen das die Tageswerte aktualisiert werden:
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: PeriodChange.317 Next period change will be calculated at 2016-03-20 00:59:55
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: PeriodChange.334 Calculating day change
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: DoStatisticsAll.367 Doing statistics (period 2) for device 'eg.hw.sz.wp'
2016.03.19 23:59:55 5: statistics eg.hw.sz.wp.stat: DoStatistics.418 Assigned reading 'Zählerstand-Bezug-Total' from attribute 'deltaReadings' to statistic type 2.
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: doStatisticDelta.672 Calculating delta statistics for 'eg.hw.sz.wp:Zählerstand-Bezug-Total = 17982.27'
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: doStatisticDelta.745 Shifting current day in last value of 'statZählerstand-Bezug-Total'.
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: doStatisticDelta.753 Shifting current hour in last value of 'statZählerstand-Bezug-Total'.
2016.03.19 23:59:55 5: statistics eg.hw.sz.wp.stat: doStatisticDelta.760 Set '.eg.hw.sz.wp:Zählerstand-Bezug-Total'='LastValue: 17982.27 ShowDate: 1 DecPlaces: 2'
2016.03.19 23:59:55 5: statistics eg.hw.sz.wp.stat: doStatisticDelta.766 Set 'statZählerstand-Bezug-Total'='Hour: 0.00 Day: 0.00 Month: 742.92 Year: 1243.90'
2016.03.19 23:59:55 4: statistics eg.hw.sz.wp.stat: doStatisticDelta.773 Set 'statZählerstand-Bezug-TotalLast'='Hour: 1.80 Day: 12.42 Month: 500.98 Year: 1882.30 (since: 2015-03-31 )'
2016.03.19 23:59:55 5: statistics eg.hw.sz.wp.stat: Notify.279 Notification of 'eg.hw.sz.wp' received but for my own readings only.

axel.mohnen

Hallo Tupol,

der Monatswechsel 03 -> 04 ist problemlos verlaufen. Das heisst das Problem ist behoben...
Nochmals vielen Dank für den Support :-)

Viele Grüsse
Axel