Doppelte Events bei userreadings

Begonnen von UvG, 24 Januar 2019, 17:30:48

Vorheriges Thema - Nächstes Thema

UvG

Hallo zusammen.
ich habe ein Problem mit doppelten Events bei userreadings.
2 Device:
Gaszähler
Internals:
   BasicFeePerMonth 11.99
   CODE       9
   CUL_0_MSGCNT 54
   CUL_0_RAWMSG E0309009A9402009A94
   CUL_0_RSSI -68.5
   CUL_0_TIME 2019-01-24 17:10:52
   CostPerUnit 0.05856
   DEF        9 0.01 0.01 0.05856 11.99
   FUUID      5c49a0b8-f33f-d79e-2990-ca721d73b26e1151
   IODev      CUL_0
   LASTInputDev CUL_0
   MSGCNT     54
   NAME       CUL_EM_9
   NR         39
   STATE      CNT: 0 CUM: 3229.230  5MIN: 0.020  TOP: 0.001
   TYPE       CUL_EM
   corr1      0.01
   corr2      0.01
   Helper:
     DBLOG:
       Gas18:
         logdb:
           TIME       1548346252.79958
           VALUE      379.43
       RAW:
         logdb:
           TIME       1548346252.79958
           VALUE      CNT: 0 CUM: 38042  5MIN: 2  TOP: 38042
       RAWMSG:
         logdb:
           TIME       1548346252.79958
           VALUE      E0309009A9402009A94
       RSSI:
         logdb:
           TIME       1548346252.79958
           VALUE      -68.5
       current:
         logdb:
           TIME       1548345349.90837
           VALUE      0.05
       current_cnt:
         logdb:
           TIME       1548345349.90837
           VALUE      5
       peak:
         logdb:
           TIME       1548345349.90837
           VALUE      0.000788788683511687
       peak_cnt:
         logdb:
           TIME       1548345349.90837
           VALUE      38033
       seqno:
         logdb:
           TIME       1548344145.89624
           VALUE      0
       statTotal:
         logdb:
           TIME       1548343844.8992
           VALUE      Hour: 0.23 Day: 4.20 Month: 117.18 Year: 117.18
       statTotalLast:
         logdb:
           TIME       1548341995.02486
           VALUE      Hour: 0.50 Day: 7.22 Month: 123.67 Year: 703.61
       state:
         logdb:
           TIME       1548345349.90837
           VALUE      CNT: 0 CUM: 3229.140  5MIN: 0.050  TOP: 0.001
       total:
         logdb:
           TIME       1548345349.90837
           VALUE      3229.14
       total_cnt:
         logdb:
           TIME       1548345349.90837
           VALUE      38033
       tsecs:
         logdb:
           TIME       1548345349.90837
           VALUE      1548345349
   READINGS:
     2019-01-24 17:10:52   Gas18           379.43
     2019-01-24 17:10:52   RAW             CNT: 0 CUM: 38042  5MIN: 2  TOP: 38042
     2018-10-16 16:44:31   basis           71891
     2019-01-24 00:02:33   cum_day         CUM_DAY: 7.220 CUM: 3224.770 COST: 0.42
     2019-01-01 00:01:36   cum_month       CUM_MONTH: 123.670 CUM: 3111.790 COST: 19.23
     2019-01-24 17:10:52   current         0.02
     2019-01-24 17:10:52   current_cnt     2
     2019-01-24 17:10:52   peak            0.000788602071394774
     2019-01-24 17:10:52   peak_cnt        38042
     2019-01-24 17:10:52   seqno           0
     2019-01-24 16:30:44   statCurrentDay  Min: 0.00 Avg: 0.02 Max: 0.11
     2019-01-23 23:59:55   statCurrentDayLast Min: 0.00 Avg: 0.03 Max: 0.12
     2019-01-24 16:30:44   statCurrentMonth Min: 0.00 Avg: 0.02 Max: 0.17
     2018-12-31 23:59:55   statCurrentMonthLast Min: 0.00 Avg: 0.01 Max: 0.17
     2019-01-24 16:30:44   statCurrentYear Min: 0.00 Avg: 0.02 Max: 0.17
     2018-12-31 23:59:55   statCurrentYearLast Min: 0.00 Avg: 0.01 Max: 0.17
     2019-01-24 16:30:44   statTotal       Hour: 0.23 Day: 4.20 Month: 117.18 Year: 117.18
     2019-01-24 15:59:55   statTotalLast   Hour: 0.50 Day: 7.22 Month: 123.67 Year: 703.61
     2019-01-24 17:10:52   state           CNT: 0 CUM: 3229.230  5MIN: 0.020  TOP: 0.001
     2019-01-24 17:10:52   total           3229.23
     2019-01-24 17:10:52   total_cnt       38042
     2019-01-24 17:10:52   tsecs           1548346252
   helper:
     _98_statistics Gaszaehler
Attributes:
   CounterOffset 2129.9
   IODev      CUL_0
   event-on-change-reading Gas18,RAW
   model      EMGZ
   mqttPublish Gas18|total:topic={"$device/$reading/"}
   room       CUL_EM
   userReadings Gas18 {ReadingsVal("CUL_EM_9","total","undef")-ReadingsVal("ablesung","Gas","undef")}

Stromzähler:
Internals:
   DEF        192.168.188.21:3000
   DeviceName 192.168.188.21:3000
   FD         66
   FUUID      5c49a0bf-f33f-d79e-79c6-4b95c0a1f9a1267a
   MeterType  SML
   NAME       ZSensor
   NR         307
   PARTIAL   
   STATE      Bezug: 2775.10 kW  verb: 411.4 W
   TYPE       OBIS
   Helper:
     DBLOG:
       Bezug18:
         logdbPV:
           TIME       1548346553.57499
           VALUE      349.1
       Einspeisung:
         logdbPV:
           TIME       1548346553.57499
           VALUE      0
       Einspeisung18:
         logdbPV:
           TIME       1548346553.57499
           VALUE      2081.5
       Gerät:
         logdbPV:
           TIME       1548346553.57499
           VALUE      EMH
       Info:
         logdbPV:
           TIME       1548346553.57499
           VALUE      0901454D4800005C9F53
       Mverbrauch:
         logdbPV:
           TIME       1548346553.57499
           VALUE      411.4
       color:
         logdbPV:
           TIME       1548346553.57499
           VALUE      #FF0000
       power:
         logdbPV:
           TIME       1548346553.57499
           VALUE      411.4
       statTotal_consumption:
         logdbPV:
           TIME       1548343914.19696
           VALUE      Hour: 224.2 Day: 4469.7 Month: 148913.9 Year: 148913.9
       statTotal_consumptionLast:
         logdbPV:
           TIME       1548341995.12538
           VALUE      Hour: 350.9 Day: 7645.6 Month: 217092.5 Year: 1566469.5
       statTotal_feed:
         logdbPV:
           TIME       1548343914.19696
           VALUE      Hour: 0.0 Day: 0.0 Month: 10035.4 Year: 10035.4
       statTotal_feedLast:
         logdbPV:
           TIME       1548341995.12538
           VALUE      Hour: 0.0 Day: 59.6 Month: 7871.4 Year: 2064419.1
       total_consumption:
         logdbPV:
           TIME       1548346553.57499
           VALUE      2775101.5
       total_consumption_Ch1:
         logdbPV:
           TIME       1548346553.57499
           VALUE      2775101.5
       total_consumption_Ch2:
         logdbPV:
           TIME       1548346553.57499
           VALUE      0
       total_feed:
         logdbPV:
           TIME       1548346553.57499
           VALUE      3596462.7
       total_feed_Ch1:
         logdbPV:
           TIME       1548346553.57499
           VALUE      3596462.7
       total_feed_Ch2:
         logdbPV:
           TIME       1548346553.57499
           VALUE      0
   READINGS:
     2018-06-11 00:28:14   0.118.7.0.14.255 0
     2018-01-09 11:11:13   1.0.0.0.9.255   09-01-45-4D-48-00-00-5C-9F-53
     2017-05-05 18:09:55   1.0.1.8.0.255   <85602.5
     2017-05-05 18:09:55   1.0.1.8.1.255   85602.5
     2017-05-05 18:09:55   1.0.1.8.2.255   0
     2017-05-05 18:09:55   1.0.16.7.0.255  -97.4
     2017-05-05 18:09:55   1.0.2.8.0.255   <152753.9
     2017-05-05 18:09:55   1.0.2.8.1.255   152753.9
     2017-05-05 18:09:55   1.0.2.8.2.255   0
     2018-10-24 22:23:44   122.119.7.129.129.255 -1e+30
     2018-09-25 12:53:22   129.129.199.130.3.255 EMH
     2019-01-24 17:15:53   129.129.199.130.5.255 0675-E89A-008F-E12C-41C6-CE57-CA06-3754-13C8-E361-C97C-BEB4-A1D3-DF6B-58AD-E2F7-AA76-2F43-DD14-831E-66C0-A49F-351C-49BD-01
     2018-08-28 11:01:46   180.22.32.6.32.255 0
     2018-08-28 10:50:45   19.150.32.6.32.255 0
     2018-08-28 11:02:46   195.118.32.6.32.255 0
     2018-08-28 10:51:45   34.150.32.6.32.255 0
     2019-01-24 17:15:53   Bezug18         349.1
     2019-01-24 17:15:53   Einspeisung     0
     2019-01-24 17:15:53   Einspeisung18   2081.5
     2019-01-24 17:15:53   Gerät          EMH
     2019-01-24 17:15:53   Info            0901454D4800005C9F53
     2019-01-24 17:15:53   Mverbrauch      411.4
     2019-01-23 04:50:38   Version         EMH\0901454D4800005C9F53
     2019-01-24 17:15:53   color           #FF0000
     2018-01-20 08:49:24   dir_total_consumption in
     2018-01-20 08:49:24   dir_total_feed  in
     2019-01-24 17:15:53   power           411.4
     2019-01-24 16:31:54   statPowerDay    Min: 53.0 Avg: 267.6 Max: 1435.7
     2019-01-23 23:59:55   statPowerDayLast Min: -309.6 Avg: 313.8 Max: 2279.6
     2019-01-24 16:31:54   statPowerMonth  Min: -817.9 Avg: 238.9 Max: 15899.9
     2018-12-31 23:59:55   statPowerMonthLast Min: -927.4 Avg: 279.7 Max: 15555.4
     2019-01-24 16:31:54   statPowerYear   Min: -817.9 Avg: 238.9 Max: 15899.9
     2018-12-31 23:59:55   statPowerYearLast Min: -2342.2 Avg: -49.5 Max: 17172.2
     2019-01-24 16:31:54   statTotal_consumption Hour: 224.2 Day: 4469.7 Month: 148913.9 Year: 148913.9
     2019-01-24 15:59:55   statTotal_consumptionLast Hour: 350.9 Day: 7645.6 Month: 217092.5 Year: 1566469.5
     2019-01-24 16:31:54   statTotal_feed  Hour: 0.0 Day: 0.0 Month: 10035.4 Year: 10035.4
     2019-01-24 15:59:55   statTotal_feedLast Hour: 0.0 Day: 59.6 Month: 7871.4 Year: 2064419.1
     2019-01-24 12:25:51   state           opened
     2019-01-24 17:15:53   total_consumption 2775101.5
     2019-01-24 17:15:53   total_consumption_Ch1 2775101.5
     2019-01-24 17:15:53   total_consumption_Ch2 0
     2019-01-24 17:15:53   total_feed      3596462.7
     2019-01-24 17:15:53   total_feed_Ch1  3596462.7
     2019-01-24 17:15:53   total_feed_Ch2  0
   helper:
     BUFFER     
     EoM        1
     SPEED      5
     TRIGGERTIME 1548329151.71254
     _98_statistics statstrom
     Channels:
       1.0.0.0.9.255 Info
       1.0.1.8.1*96 Status
       129.129.199.130.3.255 Gerät
     DEVICES:
       
       60
       
     directions:
Attributes:
   DbLogExclude 1.0.0.0.9.255,1.0.1.8.0.255,1.0.1.8.1.255,1.0.1.8.2.255,1.0.16.7.0.255,1.0.2.8.0.255,1.0.2.8.1.255,1.0.2.8.2.255,122.119.7.129.129.255,122.119.7.129.129.255,129.129.199.130.3.255,129.129.199.130.5.255
   channels   {"1.0.1.8.1*96"=>"Status","1.0.0.0.9.255"=>"Info","129.129.199.130.3.255"=>"Gerät"}
   comment    feed=>Einspeisung
consumption=>Bezug
   interval   60
   mqttPublish Bezug18|Einspeisung:topic={"$device/$reading/"}
   room       Zähler
   stateFormat {
"Bezug: ".sprintf("%.2f",(ReadingsVal($name, "total_consumption", 0)/1000))." kW".
"  verb: ".ReadingsVal($name, "power", 0)." W";
}
   unitReadings off
   userReadings Mverbrauch {ReadingsVal("smawe","total_pac","undef")*1000+ReadingsVal("ZSensor","power","undef")},
color {if (ReadingsVal("ZSensor","power","undef")< -2000){"#FF0000"}
elsif(ReadingsVal("ZSensor","power","undef")< 0){"#077730"}
elsif(ReadingsVal("ZSensor","power","undef")> 0){"#FF0000"}else {""}},
Einspeisung {if (ReadingsVal("ZSensor","power","undef")<0){(ReadingsVal("ZSensor","power","undef")*-1)}
else {0}},
Bezug18 {sprintf("%.1f",((ReadingsVal("ZSensor","total_consumption","undef"))/1000)-(ReadingsVal("ablesung","Strom","undef")))},
Einspeisung18 {sprintf("%.1f",((ReadingsVal("ZSensor","total_feed","undef"))/1000)-(ReadingsVal("ablesung","PVein","undef")))}
   valueBracket second
   verbose    0


Beide sind mit einem statistic Modul verbunden.
Wenn ich die Statistic disable sind die doppelten Events im Stromzähler weg, im Gaszähler nicht. Vermutlich wird im Modul CUL_EM für den Gaszähler Statistic intern benutzt.

Wie bekomme ich die doppelten Events weg?

Ulrich

CoolTux

#1
Hallo Ulrich,

In dem Du Dein userReadings an ein spezielles Event Bundestag bindest und nicht an alle Events.


userReadings Mverbrauch:Power:.*


Nur ein Beispiel. Du musst es natürlich entsprechend Deiner Wünsche anpassen.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

KernSani

RasPi: RFXTRX, HM, zigbee2mqtt, mySensors, JeeLink, miLight, squeezbox, Alexa, Siri, ...

CoolTux

Wie ich diese Bevormundung meines Handys hasse  ;D
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

UvG

Danke für die schnellen Anworten
Ich habe hinter power den Doppelpunkt weggelassen und so funktioniert es:
Bezug18:power.* {sprintf("%.1f",((ReadingsVal("ZSensor","total_consumption","undef"))/1000)-(ReadingsVal("ablesung","Strom","undef")))},

Warum dies aber nur mit userreadings zusammen mit Statistic passiert verstehe ich nicht.
aber man muß ja nicht alles verstehen.
Danke nochmal

Ulrich

UvG

Ich habe doch noch ein Problem und zwar mit dem Gaszähler.
Folgende Änderung habe ich bei dem Userreading gemacht:

Gas18:total.* {ReadingsVal("CUL_EM_9","total","undef")-ReadingsVal("ablesung","Gas","undef")}

Das Event wird trotzdem doppelt ausgelöst.
kann das etwas damit zu tun haben das vermutlich das Modul CUL_EM für den Gaszähler Statistic intern benutzt?

Ulrich

CoolTux

Schau mal in den Eventmonitor wie viele Events für total da kommen.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

UvG

Es kommt nur 1 Event für total und auch nur noch 1Event für Gas18.
Aber ich habe einen Deckfehler gemacht. Ich gebe über MQTT 2 Events aus Gas18, total. Diese habe ich als 2 mal den selben Wert gesehen.
Mein Fehler
Danke nochmal
Ulrich


2019-01-24 18:31:08.240 statistics Gaszaehler Updated stats for: CUL_EM_9
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 CNT: 0 CUM: 3229.780  5MIN: 0.060  TOP: 0.001
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 seqno: 0
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 peak: 0.000787463579809434
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 tsecs: 1548351068
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 total: 3229.78
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 total_cnt: 38097
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 RAW: CNT: 0 CUM: 38097  5MIN: 6  TOP: 38097
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 current_cnt: 6
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 current: 0.06
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 peak_cnt: 38097
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 Gas18: 379.98
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 RSSI: -69.5
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 RAWMSG: E030900D1940600D194
2019-01-24 18:31:08.320 CUL_EM CUL_EM_9 statTotal: Hour: 0.24 Day: 5.01 Month: 117.99 Year: 117.99