Modul 93_DbRep - Reporting und Management von Datenbankinhalten (DbLog)

Begonnen von DS_Starter, 19 Mai 2016, 22:52:13

Vorheriges Thema - Nächstes Thema

DS_Starter

Zitat
Ich hatte zunächst analog zu readingRename nach typeRename  ;D geschaut

:D ... werde DbRep anpassen. Wahrscheinlich ist die Änderung morgen früh mit dabei.
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

DS_Starter

ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

RalfRog

Cool... Super

Ich habe aber beim averageValue noch einen Fehler, der nicht wirklich mit dem Auslassen des letzten Wertes im Intervall zu tun hat.
Ich sehe momentan (muss dir noch ein Log mit verbose 5 machen), dass die gewichtet-gemittelte Stunde von x:00 bis x:59 um x-1:59 in die Datenbank geschrieben wird.

Gruß Ralf

Edit: x=0  und x-1 ist der Vortag 23 Uhr
FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

RalfRog

Hier die Egebnisse. Es wurden 24 Werte geschrieben.
Als Zeitgrenzen habe ich gewählt:
timestamp_begin     previous_day_begin
timestamp_end        previous_day_end

Soweit ich das interpretieren kann, passen die Zeitstempel der 24 Selects.
Nur am Ende das Update/Insert History ist daneben. Der Zeitstempelspringt von 2023-01-10 22:59:59 auf 2023-01-09 23:59:59.

das Log:

2023.01.11 22:22:53.001 4: DbRep DBRep_avgtim_total_power - -------- New selection ---------
2023.01.11 22:22:53.002 4: DbRep DBRep_avgtim_total_power - Command: averageValue writeToDBSingle
2023.01.11 22:22:53.005 4: DbRep DBRep_avgtim_total_power - FullDay option: 0
2023.01.11 22:22:53.006 4: DbRep DBRep_avgtim_total_power - Timestamp begin human readable: 2023-01-10 00:00:00
2023.01.11 22:22:53.007 4: DbRep DBRep_avgtim_total_power - Timestamp end human readable: 2023-01-10 23:59:59
2023.01.11 22:22:53.019 4: DbRep DBRep_avgtim_total_power - Aggregation: hour
2023.01.11 22:22:53.259 4: DbRep DBRep_avgtim_total_power - Database connect - user: fhemuser, UTF-8 option set: yes
2023.01.11 22:22:53.267 4: DbRep DBRep_avgtim_total_power - averageValue calculation sceme: avgTimeWeightMean
2023.01.11 22:22:53.281 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 00:00:00' AND TIMESTAMP < '2023-01-10 01' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.307 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 01' AND TIMESTAMP < '2023-01-10 02' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.332 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 02' AND TIMESTAMP < '2023-01-10 03' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.357 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 03' AND TIMESTAMP < '2023-01-10 04' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.386 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 04' AND TIMESTAMP < '2023-01-10 05' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.415 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 05' AND TIMESTAMP < '2023-01-10 06' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.441 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 06' AND TIMESTAMP < '2023-01-10 07' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.466 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 07' AND TIMESTAMP < '2023-01-10 08' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.497 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 08' AND TIMESTAMP < '2023-01-10 09' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.523 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 09' AND TIMESTAMP < '2023-01-10 10' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.548 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 10' AND TIMESTAMP < '2023-01-10 11' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.573 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 11' AND TIMESTAMP < '2023-01-10 12' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.598 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 12' AND TIMESTAMP < '2023-01-10 13' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.623 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 13' AND TIMESTAMP < '2023-01-10 14' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.647 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 14' AND TIMESTAMP < '2023-01-10 15' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.671 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 15' AND TIMESTAMP < '2023-01-10 16' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.696 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 16' AND TIMESTAMP < '2023-01-10 17' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.720 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 17' AND TIMESTAMP < '2023-01-10 18' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.745 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 18' AND TIMESTAMP < '2023-01-10 19' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.770 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 19' AND TIMESTAMP < '2023-01-10 20' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.793 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 20' AND TIMESTAMP < '2023-01-10 21' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.816 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 21' AND TIMESTAMP < '2023-01-10 22' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.839 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 22' AND TIMESTAMP < '2023-01-10 23' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.862 4: DbRep DBRep_avgtim_total_power - SQL execute: SELECT TIMESTAMP,VALUE FROM history where ( DEVICE = 'shelly_3em_haus' ) AND ( READING = 'total_power' ) AND TIMESTAMP >= '2023-01-10 23' AND TIMESTAMP <= '2023-01-10 23:59:59' ORDER BY TIMESTAMP ASC;
2023.01.11 22:22:53.942 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 00:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|222|, RESULT: 0E0
2023.01.11 22:22:53.945 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 00:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|222|, RESULT: 1
2023.01.11 22:22:53.957 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 01:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|124|, RESULT: 0E0
2023.01.11 22:22:53.992 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 01:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|124|, RESULT: 1
2023.01.11 22:22:54.011 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 02:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|89|, RESULT: 0E0
2023.01.11 22:22:54.021 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 02:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|89|, RESULT: 1
2023.01.11 22:22:54.029 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 03:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|111|, RESULT: 0E0
2023.01.11 22:22:54.031 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 03:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|111|, RESULT: 1
2023.01.11 22:22:54.035 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 04:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|102|, RESULT: 0E0
2023.01.11 22:22:54.037 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 04:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|102|, RESULT: 1
2023.01.11 22:22:54.040 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 05:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|101|, RESULT: 0E0
2023.01.11 22:22:54.042 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 05:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|101|, RESULT: 1
2023.01.11 22:22:54.046 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 06:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|123|, RESULT: 0E0
2023.01.11 22:22:54.048 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 06:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|123|, RESULT: 1
2023.01.11 22:22:54.052 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 07:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|403|, RESULT: 0E0
2023.01.11 22:22:54.054 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 07:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|403|, RESULT: 1
2023.01.11 22:22:54.058 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 08:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|608|, RESULT: 0E0
2023.01.11 22:22:54.060 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 08:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|608|, RESULT: 1
2023.01.11 22:22:54.063 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 09:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|74|, RESULT: 0E0
2023.01.11 22:22:54.065 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 09:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|74|, RESULT: 1
2023.01.11 22:22:54.069 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 10:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|95|, RESULT: 0E0
2023.01.11 22:22:54.071 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 10:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|95|, RESULT: 1
2023.01.11 22:22:54.075 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 11:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|71|, RESULT: 0E0
2023.01.11 22:22:54.077 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 11:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|71|, RESULT: 1
2023.01.11 22:22:54.080 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 12:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|121|, RESULT: 0E0
2023.01.11 22:22:54.082 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 12:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|121|, RESULT: 1
2023.01.11 22:22:54.086 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 13:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|74|, RESULT: 0E0
2023.01.11 22:22:54.088 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 13:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|74|, RESULT: 1
2023.01.11 22:22:54.092 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 14:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|239|, RESULT: 0E0
2023.01.11 22:22:54.094 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 14:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|239|, RESULT: 1
2023.01.11 22:22:54.098 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 15:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|164|, RESULT: 0E0
2023.01.11 22:22:54.100 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 15:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|164|, RESULT: 1
2023.01.11 22:22:54.104 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 16:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|321|, RESULT: 0E0
2023.01.11 22:22:54.106 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 16:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|321|, RESULT: 1
2023.01.11 22:22:54.109 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 17:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|297|, RESULT: 0E0
2023.01.11 22:22:54.111 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 17:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|297|, RESULT: 1
2023.01.11 22:22:54.115 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 18:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|262|, RESULT: 0E0
2023.01.11 22:22:54.117 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 18:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|262|, RESULT: 1
2023.01.11 22:22:54.121 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 19:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|220|, RESULT: 0E0
2023.01.11 22:22:54.123 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 19:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|220|, RESULT: 1
2023.01.11 22:22:54.127 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 20:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|414|, RESULT: 0E0
2023.01.11 22:22:54.129 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 20:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|414|, RESULT: 1
2023.01.11 22:22:54.132 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 21:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|262|, RESULT: 0E0
2023.01.11 22:22:54.134 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 21:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|262|, RESULT: 1
2023.01.11 22:22:54.139 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-10 22:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|260|, RESULT: 0E0
2023.01.11 22:22:54.141 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-10 22:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|260|, RESULT: 1
2023.01.11 22:22:54.144 4: DbRep DBRep_avgtim_total_power - UPDATE history: 2023-01-09 23:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|202|, RESULT: 0E0
2023.01.11 22:22:54.146 4: DbRep DBRep_avgtim_total_power - INSERT history: 2023-01-09 23:59:59|shelly_3em_haus|Shelly|calculated|avgtwm_hour_total_power|202|, RESULT: 1
2023.01.11 22:22:54.154 3: DbRep DBRep_avgtim_total_power - number of lines updated in "DBLogging": 0
2023.01.11 22:22:54.155 3: DbRep DBRep_avgtim_total_power - number of lines inserted into "DBLogging": 24
2023.01.11 22:22:54.172 4: DbRep DBRep_avgtim_total_power - execute command after averageValue: 'msg push -1 [DBRep_avgtim_total_power:state] taegliche Chain abgearbeitet fuer Mittelwerte Plug:power 3EM:total_power MT691_power'
2023.01.11 22:22:54.372 3: msg globalMsg: ID=1673472174.17602.1 TYPE=push ROUTE=teleBot STATUS=OK PRIORITY=-1(Low) TITLE='' MSG='running taegliche Chain abgearbeitet fuer Mittelwerte Plug:power 3EM:total_power MT691_power'


Die Daten als Anhang.


Gruß Ralf
FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

DS_Starter

Welche Readings bekommst du wenn du die gleiche Selektion mit der "display" Option ausführst ?
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

RalfRog

Ich hoffe das ist so ok, quaisi eine Stunde verschoben aber die gleichen Werte:


2023-01-10_00__shelly_3em_haus__total_power__AVGTWM__2023-01-10_00 222 2023-01-11 22:49:52
2023-01-10_01__shelly_3em_haus__total_power__AVGTWM__2023-01-10_01 124 2023-01-11 22:49:52
2023-01-10_02__shelly_3em_haus__total_power__AVGTWM__2023-01-10_02 89 2023-01-11 22:49:52
2023-01-10_03__shelly_3em_haus__total_power__AVGTWM__2023-01-10_03 111 2023-01-11 22:49:52
2023-01-10_04__shelly_3em_haus__total_power__AVGTWM__2023-01-10_04 102 2023-01-11 22:49:52
2023-01-10_05__shelly_3em_haus__total_power__AVGTWM__2023-01-10_05 101 2023-01-11 22:49:52
2023-01-10_06__shelly_3em_haus__total_power__AVGTWM__2023-01-10_06 123 2023-01-11 22:49:52
2023-01-10_07__shelly_3em_haus__total_power__AVGTWM__2023-01-10_07 403 2023-01-11 22:49:52
2023-01-10_08__shelly_3em_haus__total_power__AVGTWM__2023-01-10_08 608 2023-01-11 22:49:52
2023-01-10_09__shelly_3em_haus__total_power__AVGTWM__2023-01-10_09 74 2023-01-11 22:49:52
2023-01-10_10__shelly_3em_haus__total_power__AVGTWM__2023-01-10_10 95 2023-01-11 22:49:52
2023-01-10_11__shelly_3em_haus__total_power__AVGTWM__2023-01-10_11 71 2023-01-11 22:49:52
2023-01-10_12__shelly_3em_haus__total_power__AVGTWM__2023-01-10_12 121 2023-01-11 22:49:52
2023-01-10_13__shelly_3em_haus__total_power__AVGTWM__2023-01-10_13 74 2023-01-11 22:49:52
2023-01-10_14__shelly_3em_haus__total_power__AVGTWM__2023-01-10_14 239 2023-01-11 22:49:52
2023-01-10_15__shelly_3em_haus__total_power__AVGTWM__2023-01-10_15 164 2023-01-11 22:49:52
2023-01-10_16__shelly_3em_haus__total_power__AVGTWM__2023-01-10_16 321 2023-01-11 22:49:52
2023-01-10_17__shelly_3em_haus__total_power__AVGTWM__2023-01-10_17 297 2023-01-11 22:49:52
2023-01-10_18__shelly_3em_haus__total_power__AVGTWM__2023-01-10_18 262 2023-01-11 22:49:52
2023-01-10_19__shelly_3em_haus__total_power__AVGTWM__2023-01-10_19 220 2023-01-11 22:49:52
2023-01-10_20__shelly_3em_haus__total_power__AVGTWM__2023-01-10_20 414 2023-01-11 22:49:52
2023-01-10_21__shelly_3em_haus__total_power__AVGTWM__2023-01-10_21 262 2023-01-11 22:49:52
2023-01-10_22__shelly_3em_haus__total_power__AVGTWM__2023-01-10_22 260 2023-01-11 22:49:52
2023-01-10_23__shelly_3em_haus__total_power__AVGTWM__2023-01-10_23 202 2023-01-11 22:49:52
state done 2023-01-11 22:49:52
FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

RalfRog

FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

RalfRog

So jetzt gleich sortiert


Datenbank                                                     Display
2023-01-09 23:59:59;avgtwm_hour_total_power;202;             
2023-01-10 00:59:59;avgtwm_hour_total_power;222;              total_power__AVGTWM__2023-01-10_00 222
2023-01-10 01:59:59;avgtwm_hour_total_power;124;              total_power__AVGTWM__2023-01-10_01 124
2023-01-10 02:59:59;avgtwm_hour_total_power;89;\              total_power__AVGTWM__2023-01-10_02 89
2023-01-10 03:59:59;avgtwm_hour_total_power;111;              total_power__AVGTWM__2023-01-10_03 111
2023-01-10 04:59:59;avgtwm_hour_total_power;102;              total_power__AVGTWM__2023-01-10_04 102
2023-01-10 05:59:59;avgtwm_hour_total_power;101;              total_power__AVGTWM__2023-01-10_05 101
2023-01-10 06:59:59;avgtwm_hour_total_power;123;              total_power__AVGTWM__2023-01-10_06 123
2023-01-10 07:59:59;avgtwm_hour_total_power;403;              total_power__AVGTWM__2023-01-10_07 403
2023-01-10 08:59:59;avgtwm_hour_total_power;608;              total_power__AVGTWM__2023-01-10_08 608
2023-01-10 09:59:59;avgtwm_hour_total_power;74;\              total_power__AVGTWM__2023-01-10_09 74
2023-01-10 10:59:59;avgtwm_hour_total_power;95;\              total_power__AVGTWM__2023-01-10_10 95
2023-01-10 11:59:59;avgtwm_hour_total_power;71;\              total_power__AVGTWM__2023-01-10_11 71
2023-01-10 12:59:59;avgtwm_hour_total_power;121;              total_power__AVGTWM__2023-01-10_12 121
2023-01-10 13:59:59;avgtwm_hour_total_power;74;\              total_power__AVGTWM__2023-01-10_13 74
2023-01-10 14:59:59;avgtwm_hour_total_power;239;              total_power__AVGTWM__2023-01-10_14 239
2023-01-10 15:59:59;avgtwm_hour_total_power;164;              total_power__AVGTWM__2023-01-10_15 164
2023-01-10 16:59:59;avgtwm_hour_total_power;321;              total_power__AVGTWM__2023-01-10_16 321
2023-01-10 17:59:59;avgtwm_hour_total_power;297;              total_power__AVGTWM__2023-01-10_17 297
2023-01-10 18:59:59;avgtwm_hour_total_power;262;              total_power__AVGTWM__2023-01-10_18 262
2023-01-10 19:59:59;avgtwm_hour_total_power;220;              total_power__AVGTWM__2023-01-10_19 220
2023-01-10 20:59:59;avgtwm_hour_total_power;414;              total_power__AVGTWM__2023-01-10_20 414
2023-01-10 21:59:59;avgtwm_hour_total_power;262;              total_power__AVGTWM__2023-01-10_21 262
2023-01-10 22:59:59;avgtwm_hour_total_power;260;              total_power__AVGTWM__2023-01-10_22 260
                                                            total_power__AVGTWM__2023-01-10_23 202
FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

DS_Starter

ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

RalfRog

Wenn ich die zugrunde liegenden Werte betrachte gehört der Wert in der Datenbank am 9.1 um 23:59 Uhr eigentlich zum 10.1 23:59 Uhr

Alles klar.
FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

DS_Starter

Ja, ich habe eine Idee ... In der Rückschreibroutine gefunden. Aber es ist zu kompliziert für diese Uhrzeit.
Das stelle ich besser zurück.
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

RalfRog

Immer gemach und mit der nötigen Ruhe. Verschlimmbessern ist auch doof.

Das Problem an den Datenbankgeschichten ist, dass es nur beim Ausprobieren auffällt.
Wenn das mal im Regelbetrieb und damit permanent läuft, fällt die Verschiebung nicht mehr auf. Es sind ja alle Zeitstempel bedient und wenn dann die Datenbank noch reduziert ist kann man auch nicht "nachrechnen".

Beim Verbrauch mit dem Shelly_3EM gemessen fällt es etwas leichter auf, da zu allen Uhrzeiten ohne Lücken permanent Strom fließt und damit Leistung ansteht.

Gruß Ralf und gutes Gelingen mit der Idee
FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder

alkazaa

Moin allerseits!

Ich möcht auch noch mal mein bisschen Senf dazu geben. Und zwar bezüglich des gewichteten Mittelns, bei dem ja Datenpunkte, deren "Gültigkeitszeitraum" die Grenzen der Mittelungsintervalle überschneiden, nicht berücksichtigt werden.

Ich habe die entsprechende Routine in 93_DbRep.pm so angepasst, dass diese Datenpunkte anteilig dem jeweiligen Mittelungsintervall zugerechnet werden. Ein Nebeneffekt: auch Intervalle mit nur einem Datenpunkt sind nun möglich.

Hier mal das Ergebnis für den extremen Fall, dass nur etwa jedes 2. Intervall einen Datenpunkt enthält:
Die Originaldaten:
TIMESTAMP         VALUE
2023-01-08 00:11:01 0.289
2023-01-08 00:12:36 0.284
2023-01-08 00:14:12 0.336
2023-01-08 00:15:45 0.479
2023-01-08 00:17:22 0.272
2023-01-08 00:20:32 0.503
2023-01-08 00:22:04 0.496
2023-01-08 00:25:15 0.488

Ergebnis  mit der alten Mittelung:
Readings
2023-01-08_00-09__E_Zaehler__power__AVGTWM__2023-01-08_00_09 - 2023-01-12 13:18:18
2023-01-08_00-10__E_Zaehler__power__AVGTWM__2023-01-08_00_10 - 2023-01-12 13:18:18
2023-01-08_00-11__E_Zaehler__power__AVGTWM__2023-01-08_00_11 0.0000 2023-01-12 13:18:18
2023-01-08_00-12__E_Zaehler__power__AVGTWM__2023-01-08_00_12 0.0000 2023-01-12 13:18:18
2023-01-08_00-13__E_Zaehler__power__AVGTWM__2023-01-08_00_13 - 2023-01-12 13:18:18
2023-01-08_00-14__E_Zaehler__power__AVGTWM__2023-01-08_00_14 0.0000 2023-01-12 13:18:18
2023-01-08_00-15__E_Zaehler__power__AVGTWM__2023-01-08_00_15 0.0000 2023-01-12 13:18:18
2023-01-08_00-16__E_Zaehler__power__AVGTWM__2023-01-08_00_16 - 2023-01-12 13:18:18
2023-01-08_00-17__E_Zaehler__power__AVGTWM__2023-01-08_00_17 0.0000 2023-01-12 13:18:18
2023-01-08_00-18__E_Zaehler__power__AVGTWM__2023-01-08_00_18 - 2023-01-12 13:18:18
2023-01-08_00-19__E_Zaehler__power__AVGTWM__2023-01-08_00_19 - 2023-01-12 13:18:18
2023-01-08_00-20__E_Zaehler__power__AVGTWM__2023-01-08_00_20 0.0000 2023-01-12 13:18:18
2023-01-08_00-21__E_Zaehler__power__AVGTWM__2023-01-08_00_21 - 2023-01-12 13:18:18
2023-01-08_00-22__E_Zaehler__power__AVGTWM__2023-01-08_00_22 0.0000 2023-01-12 13:18:18
2023-01-08_00-23__E_Zaehler__power__AVGTWM__2023-01-08_00_23 - 2023-01-12 13:18:18
2023-01-08_00-24__E_Zaehler__power__AVGTWM__2023-01-08_00_24 - 2023-01-12 13:18:18
2023-01-08_00-25__E_Zaehler__power__AVGTWM__2023-01-08_00_25 0.0000 2023-01-12 13:18:18
2023-01-08_00-26__E_Zaehler__power__AVGTWM__2023-01-08_00_26 - 2023-01-12 13:18:18
2023-01-08_00-27__E_Zaehler__power__AVGTWM__2023-01-08_00_27 - 2023-01-12 13:18:18
2023-01-08_00-28__E_Zaehler__power__AVGTWM__2023-01-08_00_28 - 2023-01-12 13:18:18
2023-01-08_00-29__E_Zaehler__power__AVGTWM__2023-01-08_00_29 - 2023-01-12 13:18:18
2023-01-08_00-30__E_Zaehler__power__AVGTWM__2023-01-08_00_30 - 2023-01-12 13:18:18
background_processing_time 0.1199 2023-01-12 13:18:18
sql_processing_time 0.1091 2023-01-12 13:18:18
state done 2023-01-12 13:18:18

Ergebnis  mit der neuen Mittelung:
Readings
2023-01-08_00-09__E_Zaehler__power__AVGTWM__2023-01-08_00_09 - 2023-01-12 13:11:33
2023-01-08_00-10__E_Zaehler__power__AVGTWM__2023-01-08_00_10 - 2023-01-12 13:11:33
2023-01-08_00-11__E_Zaehler__power__AVGTWM__2023-01-08_00_11 0.2890 2023-01-12 13:11:33
2023-01-08_00-12__E_Zaehler__power__AVGTWM__2023-01-08_00_12 0.2870 2023-01-12 13:11:33
2023-01-08_00-13__E_Zaehler__power__AVGTWM__2023-01-08_00_13 0.2840 2023-01-12 13:11:33
2023-01-08_00-14__E_Zaehler__power__AVGTWM__2023-01-08_00_14 0.3256 2023-01-12 13:11:33
2023-01-08_00-15__E_Zaehler__power__AVGTWM__2023-01-08_00_15 0.3718 2023-01-12 13:11:33
2023-01-08_00-16__E_Zaehler__power__AVGTWM__2023-01-08_00_16 0.4790 2023-01-12 13:11:33
2023-01-08_00-17__E_Zaehler__power__AVGTWM__2023-01-08_00_17 0.3479 2023-01-12 13:11:33
2023-01-08_00-18__E_Zaehler__power__AVGTWM__2023-01-08_00_18 0.2720 2023-01-12 13:11:33
2023-01-08_00-19__E_Zaehler__power__AVGTWM__2023-01-08_00_19 0.2720 2023-01-12 13:11:33
2023-01-08_00-20__E_Zaehler__power__AVGTWM__2023-01-08_00_20 0.3798 2023-01-12 13:11:33
2023-01-08_00-21__E_Zaehler__power__AVGTWM__2023-01-08_00_21 0.5030 2023-01-12 13:11:33
2023-01-08_00-22__E_Zaehler__power__AVGTWM__2023-01-08_00_22 0.4965 2023-01-12 13:11:33
2023-01-08_00-23__E_Zaehler__power__AVGTWM__2023-01-08_00_23 0.4960 2023-01-12 13:11:33
2023-01-08_00-24__E_Zaehler__power__AVGTWM__2023-01-08_00_24 0.4960 2023-01-12 13:11:33
2023-01-08_00-25__E_Zaehler__power__AVGTWM__2023-01-08_00_25 0.4900 2023-01-12 13:11:33
2023-01-08_00-26__E_Zaehler__power__AVGTWM__2023-01-08_00_26 0.4880 2023-01-12 13:11:33
2023-01-08_00-27__E_Zaehler__power__AVGTWM__2023-01-08_00_27 0.4880 2023-01-12 13:11:33
2023-01-08_00-28__E_Zaehler__power__AVGTWM__2023-01-08_00_28 0.4880 2023-01-12 13:11:33
2023-01-08_00-29__E_Zaehler__power__AVGTWM__2023-01-08_00_29 0.4880 2023-01-12 13:11:33
2023-01-08_00-30__E_Zaehler__power__AVGTWM__2023-01-08_00_30 0.0000 2023-01-12 13:11:33
background_processing_time 0.1567 2023-01-12 13:11:33
sql_processing_time 0.1446 2023-01-12 13:11:33
state done 2023-01-12 13:11:3


Der (kommentierte) Code ist im Anhang. Änderungen wurden nur in der "sub DbRep_averval" vorgenommen. Alle Änderungen sind mit 'alkazaa' markiert.
(Disclaimer: ich bin immer noch ziemlicher Perl-Anfänger, also auf Risiken und Nebenwirkungen achten)

Beste Grüße
Franz

DS_Starter

Moin Franz,

danke. Nehme ich gerne entgegen und versuche deinen Patch einzubauen und gegenzuchecken.
Melde mich wenn ich eine Testversion fertig habe.

LG
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

RalfRog

Zitat von: alkazaa am 12 Januar 2023, 13:44:07
....
Hier mal das Ergebnis für den extremen Fall, dass nur etwa jedes 2. Intervall einen Datenpunkt enthält:
Die Originaldaten:
TIMESTAMP         VALUE
2023-01-08 00:11:01 0.289
2023-01-08 00:12:36 0.284
............

Ergebnis  mit der alten Mittelung:
Readings
2023-01-08_00-09__E_Zaehler__power__AVGTWM__2023-01-08_00_09 - 2023-01-12 13:18:18
2023-01-08_00-10__E_Zaehler__power__AVGTWM__2023-01-08_00_10 - 2023-01-12 13:18:18
............

Ergebnis  mit der neuen Mittelung:
Readings
2023-01-08_00-09__E_Zaehler__power__AVGTWM__2023-01-08_00_09 - 2023-01-12 13:11:33
2023-01-08_00-10__E_Zaehler__power__AVGTWM__2023-01-08_00_10 - 2023-01-12 13:11:33
.........

....

Hallo Franz
Upps das ist höhere Mathematik  ::)

Das mit der alten Mittelung in den  Minuten 11,12,14,15,17,20,22,25 nur Null herauskommt ist natürlich unschön.

Die neue Mittelung verstehe ich auch nicht so ganz (liegt vermutlich am Fehlverständnis von Datenpunkt, Mittelungsintervall & zeitliche Grenzen (BIN)) bzw. es entsteht nicht das, was ich erwarten würde (wenn das Intervall eine Miunte ist). Am Anfang / Mitte komme ich glaube ich soweit mit.

Z.B. die Minuten 26-29 sind ohne Werte - trotzdem ist das AVG-Ergebnis der Wert von Minute 25. Müsste das nicht zumindest kleiner werden - bzw. ab wann gilt denn 0?
Müsste ja ab der kompletten Minute 30 sein - also nach 29 (ist ja noch 0,488)
   ::) Oh je


FHEM auf Raspi 2B mit nanoCUL, HM-MOD-RPI-PCB und über LAN MAX!Cube mit a-culFW (Stack 868 + 433)
HM- Fensterkontakte, UP-Schalter, Bewegungsmelder und ein Rauchmelder