Hallo,
ich versuche gerade mich in das Statistik Modul statistics einzuarbeiten.
Das mache ich an einem sinnfreien Beispiel, wo aber ständig neue Daten anfallen und man auch besser HourCounter verwendet.
Mir geht es aber nur darum, das Handling des statistics Modules zu verstehen und nicht darum, dass andere Module diese Arbeit ebenfalls erledigen.
Vorhanden ist ein Reed Kontakt, der schon Daten liefert und mittels HourCounter und GasCalculator bereits ausgewertet wird.
Gezählt werden soll (wie erwähnt nur zu Übungszwecken mit dem statistics Modul), wie oft der Kontakt schaltet. Das geht auch mit HourCounter, aber ich möchte es mit statistics machen.
Internals:
CFGFN
DEF ReedGas_GPIO2_Pin13
DEV_REGEXP ReedGas_GPIO2_Pin13
FUUID 632c357f-f33f-6428-1a24-35d3f7da3c6aa8c0
NAME Statistik
NOTIFYDEV global,ReedGas_GPIO2_Pin13
NR 697
NTFY_ORDER 10-Statistik
PREFIX stat
STATE Updated stats for: ReedGas_GPIO2_Pin13
TYPE statistics
READINGS:
2022-09-22 12:14:35 monitoredDevicesRPI_GPIO ReedGas_GPIO2_Pin13
2022-09-24 12:59:55 nextPeriodChangeCalc 2022-09-24 13:59:55
2022-09-24 12:59:55 state Updated stats for: ReedGas_GPIO2_Pin13
fhem:
modulVersion $Date: 2019-12-24 00:07:57 +0100 (Di, 24 Dez 2019) $
nextPeriodChangeTime 1664020795
Attributes:
durationPeriodHour 1
durationReadings state
ignoreDefaultAssignments 1
room Statistik
singularReadings ReedGas_GPIO2_Pin13:state:on:(Year|Month|Hour|Day)
Wie beabsichtigt werden dann im entsprechenden Device die neuen Readings erzeugt
Internals:
DEF 27
EXCEPT_FD 7
FUUID 6306085e-f33f-6428-6a36-18f95bb34d668ed0
GPIO_Basedir /sys/class/gpio
GPIO_Nr 27
NAME ReedGas_GPIO2_Pin13
NR 15
STATE off
TYPE RPI_GPIO
WiringPi_gpio /usr/bin/gpio
lasttrg 1664016938.70661
OLDREADINGS:
READINGS:
2022-09-24 12:55:51 Dblclick off
2022-09-24 12:55:51 Longpress off
2022-09-24 13:15:22 Pinlevel low
2022-09-24 12:59:55 statStateDay off: 07:18:47 off_Count: 123 on: 05:41:13 on_Count: 123
2022-09-23 23:59:55 statStateDayLast off: 17:25:33 off_Count: 189 on: 06:34:27 on_Count: 189
2022-09-24 12:59:55 statStateDayon 05:41:13
2022-09-23 23:59:55 statStateDayonLast 06:34:27
2022-09-24 12:59:55 statStateHour off: 00:00:00 off_Count: 1
2022-09-24 12:59:55 statStateHourLast off: 00:30:25 off_Count: 17 on: 00:29:35 on_Count: 16
2022-09-24 12:59:55 statStateHouron 00:00:00
2022-09-24 12:59:55 statStateHouronLast 00:29:35
2022-09-24 12:59:55 statStateMonth off: 1d 06:38:33 off_Count: 351 on: 18:06:48 on_Count: 351 (since: 2022-09-22_12:14:34)
2022-09-24 12:59:55 statStateMonthon 18:06:48
2022-09-24 12:59:55 statStateYear off: 1d 06:38:35 off_Count: 351 on: 18:06:46 on_Count: 351 (since: 2022-09-22_12:14:34)
2022-09-24 12:59:55 statStateYearon 18:06:46
2022-09-24 12:55:51 state off
fhem:
interfaces switch
helper:
_98_statistics Statistik
Attributes:
active_low yes
debounce_in_ms 100
devStateIcon on:humidity@red off:humidity@blue
direction input
interrupt both
pud_resistor up
room HWR_GAS
Die Readings sehen dann im Log so aus:
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast: off: 00:14:14 off_Count: 12 on: 00:45:46 on_Count: 12
Die Off und On Counts lassen sich dann im Plot auch wie gewünscht darstellen, man muss dann nur Spalten 7 und/oder 11 angeben.
Nun zur Frage:
Gibt es über statistics eine Möglichkeit die Readings einzeln aufzulisten?
Danke
Hallo TomasFh
ich nutze das Attrbut singularReadings in diesem Modul und denke, dass ist das wonach Du suchst.
Grüße
Jens
Zitat von: dyna am 24 September 2022, 20:12:24
Hallo TomasFh
ich nutze das Attrbut singularReadings in diesem Modul und denke, dass ist das wonach Du suchst.
Grüße
Jens
das nutze ich doch auch, siehe 2tes Listing:
singularReadings ReedGas_GPIO2_Pin13:state:on:(Year|Month|Hour|Day)
ZitatGibt es über statistics eine Möglichkeit die Readings einzeln aufzulisten?
Du meinst also so
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_off: 00:14:14
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_off_Count: 12
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_on: 00:45:46
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_on_Count: 12
?
Ich glaub nicht, dass das per Einstellung geht. Aber natürlich mit sonstigen FHEM-Mitteln....
Zitat von: KölnSolar am 27 September 2022, 09:07:13
Du meinst also so 2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_off: 00:14:14
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_off_Count: 12
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_on: 00:45:46
2022-09-24_11:59:55 ReedGas_GPIO2_Pin13 statStateHourLast_on_Count: 12
?
Ich glaub nicht, dass das per Einstellung geht. Aber natürlich mit sonstigen FHEM-Mitteln....
ja genau, so meinte ich das.