Hallo,
ich würde gerne die Tageswerte meines Zählers in der DBLog vermerken.
Ich habe ein DBLoginclude für die entsprechenden Readings mit :86400 was 24h entspricht eingestellt.
Trotzdem loggt er jede Änderung des Readings. Warum zieht die Zeitangabe nicht?!
Internals:
DEF /dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_015AE653-if00-port0@9600,8,E,1 SML
DeviceName /dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_015AE653-if00-port0@9600,8,E,1
MeterType SML
NAME Zaehler_WP
NR 25
PARTIAL
STATE 3662.34 kWh - 686.97 € (NT=18,17 Ct + HT=20,74 Ct)
TYPE OBIS
Helper:
DBLOG:
power_clear:
DBLogging:
TIME 1549709668.55932
VALUE 44.9
total_consumption:
DBLogging:
TIME 1549708980.58659
VALUE 3662333.5 Wh
total_consumption_Ch2_Wh_clear:
DBLogging:
TIME 1549709046.91548
VALUE 837437.6
total_consumption_Ch2_clear_Wh:
DBLogging:
TIME 1549709668.55932
VALUE 837445.3
total_consumption_clear_Wh:
DBLogging:
TIME 1549709668.55932
VALUE 3662342
OLDREADINGS:
READINGS:
2018-09-20 06:28:41 0.118.7.0.10.255 0*var
2019-02-01 16:58:25 0.118.7.0.11.255 0*var
2018-07-28 14:32:41 0.118.7.0.9.255 0*var
2019-02-09 11:54:28 1.0.0.0.9.255 06-45-4D-48-01-0E-15-BE-87-A5
2019-02-09 11:54:28 129.129.199.130.3.255 EMH
2019-02-09 09:05:32 Version EMH\06454D48010E15BE87A5
2019-02-09 11:54:28 power 44.9 W
2019-02-09 11:54:28 power_clear 44.9
2019-02-09 11:54:28 statPowerDay Min: 44.0 Avg: 48.1 Max: 89.9
2019-02-08 23:59:55 statPowerDayLast Min: 48.8 Avg: 287.3 Max: 48.8
2019-02-09 11:54:28 statPowerMonth Min: 43.7 Avg: 673.2 Max: 2937.7
2019-01-31 23:59:55 statPowerMonthLast Min: 1914.0 Avg: 515.1 Max: 1914.0
2019-02-09 11:54:28 statPowerYear Min: 43.6 Avg: 549.1 Max: 3004.3
2018-12-31 23:59:55 statPowerYearLast Min: 48.2 Avg: 157.1 Max: 48.2 (since: )
2019-02-09 11:54:28 statTotal_consumption Hour: 42.5 Day: 574.2 Month: 137283.9 Year: 520502.6
2019-02-09 10:59:55 statTotal_consumptionLast Hour: 48.3 Day: 6895.9 Month: 383218.7 Year: 1035061.6 (since: 2018-03-22 )
2019-02-09 11:54:28 statTotal_consumption_Ch1 Hour: 0.0 Day: 314.0 Month: 113959.4 Year: 448422.6
2019-02-09 10:59:55 statTotal_consumption_Ch1Last Hour: 0.0 Day: 6378.4 Month: 334463.2 Year: 832081.7 (since: 2018-03-22 )
2019-02-09 11:54:28 statTotal_consumption_Ch2 Hour: 42.5 Day: 260.2 Month: 23324.5 Year: 72080.0
2019-02-09 10:59:55 statTotal_consumption_Ch2Last Hour: 48.3 Day: 517.5 Month: 48755.5 Year: 202979.9 (since: 2018-03-22 )
2019-02-09 11:54:28 statTotal_costs_Ch1 Hour: 0.00 € Day: 0.06 € Month: 20.71 € Year: 81.48 € (18,17 Ct a kWh)
2019-02-09 11:54:28 statTotal_costs_Ch1Last Hour: 0.00 € Day: 1.16 € Month: 60.77 € Year: 151.19 € (since: 2018-03-22 )(18,17 Ct a kWh)
2019-02-09 11:54:28 statTotal_costs_Ch1_Total_Merged 2824.90 kWh - 513.28 € (18,17 Ct a kWh)
2019-02-09 11:54:28 statTotal_costs_Ch2 Hour: 0.01 € Day: 0.05 € Month: 4.84 € Year: 14.95 € (20,74 Ct a kWh)
2019-02-09 11:54:28 statTotal_costs_Ch2Last Hour: 0.01 € Day: 0.11 € Month: 10.11 € Year: 42.10 € (since: 2018-03-22 ) (20,74 Ct a kWh)
2019-02-09 11:54:28 statTotal_costs_Ch2_Total_Merged 837.45 kWh - 173.69 € (20,74 Ct a kWh)
2019-02-09 11:54:28 statTotal_costs_Total_Merged_Ch1_Ch2 3662.34 kWh - 686.97 € (NT=18,17 Ct + HT=20,74 Ct)
2019-01-23 18:55:07 state opened
2019-02-09 11:54:28 total_consumption 3662342 Wh
2019-02-09 11:54:28 total_consumption_Ch1 2824896.7 Wh
2019-02-09 11:54:28 total_consumption_Ch1_clear_Wh 2824896.7
2019-02-09 11:54:28 total_consumption_Ch2 837445.3 Wh
2019-02-09 11:54:28 total_consumption_Ch2_clear_Wh 837445.3
2019-02-09 11:44:06 total_consumption_Wh_clear 3662334.3
2019-02-09 11:54:28 total_consumption_clear_Wh 3662342
helper:
BUFFER
EoM 1
SPEED 5
SPEED2 5
TRIGGERTIME 1548266107.95852
_98_statistics StatStrom_WP
Channels:
DEVICES:
5
directions:
Attributes:
DbLogExclude .*
DbLogInclude power_clear:60,total_consumption_clear_Wh:86400,total_consumption_Ch1_clear_Wh:86400,total_consumption_Ch2_clear_Wh:86400
alias Smartmeter Heizung (Nr.: 36311291)
event-on-change-reading .*
icon measure_power_meter
interval 5
pollingMode on
room EG,HWR
stateFormat statTotal_costs_Total_Merged_Ch1_Ch2
unitReadings on
userReadings power_clear {
my @val = split(/ /,ReadingsVal($NAME, "power", 0) );;
sprintf(
"%s",
$val[0])
}
,
total_consumption_clear_Wh {
my @val = split(/ /,ReadingsVal($NAME, "total_consumption", 0) );;
sprintf(
"%s",
$val[0])
}
,
total_consumption_Ch1_clear_Wh {
my @val = split(/ /,ReadingsVal($NAME, "total_consumption_Ch1", 0) );;
sprintf(
"%s",
$val[0])
}
,
total_consumption_Ch2_clear_Wh {
my @val = split(/ /,ReadingsVal($NAME, "total_consumption_Ch2", 0) );;
sprintf(
"%s",
$val[0])
}
,
statTotal_costs_Ch1 {
my @costs_Ch1 = split(/ /,ReadingsVal($NAME, "statTotal_consumption_Ch1", 0) );;
sprintf(
"%s %.2f € %s %.2f € %s %.2f € %s %.2f € (18,17 Ct a kWh)",
$costs_Ch1[0],
$costs_Ch1[1]/1000*0.1817,
$costs_Ch1[2],
$costs_Ch1[3]/1000*0.1817,
$costs_Ch1[4],
$costs_Ch1[5]/1000*0.1817,
$costs_Ch1[6],
$costs_Ch1[7]/1000*0.1817
)
}
,
statTotal_costs_Ch1Last {
my @costs_Ch1Last = split(/ /,ReadingsVal($NAME, "statTotal_consumption_Ch1Last", 0) );;
sprintf(
"%s %.2f € %s %.2f € %s %.2f € %s %.2f € %s %s %s(18,17 Ct a kWh)",
$costs_Ch1Last[0],
$costs_Ch1Last[1]/1000*0.1817,
$costs_Ch1Last[2],
$costs_Ch1Last[3]/1000*0.1817,
$costs_Ch1Last[4],
$costs_Ch1Last[5]/1000*0.1817,
$costs_Ch1Last[6],
$costs_Ch1Last[7]/1000*0.1817,
$costs_Ch1Last[8],
$costs_Ch1Last[9],
$costs_Ch1Last[10]
)
}
,
statTotal_costs_Ch1_Total_Merged {
sprintf(
"%.2f kWh - %.2f € (18,17 Ct a kWh)",
ReadingsNum($NAME,"total_consumption_Ch1",0)/1000,
ReadingsNum($NAME,"total_consumption_Ch1",0)/1000*0.1817
)
}
,
statTotal_costs_Ch2 {
my @costs_Ch2 = split(/ /,ReadingsVal($NAME, "statTotal_consumption_Ch2", 0) );;
sprintf(
"%s %.2f € %s %.2f € %s %.2f € %s %.2f € (20,74 Ct a kWh)",
$costs_Ch2[0],
$costs_Ch2[1]/1000*0.2074,
$costs_Ch2[2],
$costs_Ch2[3]/1000*0.2074,
$costs_Ch2[4],
$costs_Ch2[5]/1000*0.2074,
$costs_Ch2[6],
$costs_Ch2[7]/1000*0.2074
)
}
,
statTotal_costs_Ch2Last {
my @costs_Ch2Last = split(/ /,ReadingsVal($NAME, "statTotal_consumption_Ch2Last", 0) );;
sprintf(
"%s %.2f € %s %.2f € %s %.2f € %s %.2f € %s %s %s (20,74 Ct a kWh)",
$costs_Ch2Last[0],
$costs_Ch2Last[1]/1000*0.2074,
$costs_Ch2Last[2],
$costs_Ch2Last[3]/1000*0.2074,
$costs_Ch2Last[4],
$costs_Ch2Last[5]/1000*0.2074,
$costs_Ch2Last[6],
$costs_Ch2Last[7]/1000*0.2074,
$costs_Ch2Last[8],
$costs_Ch2Last[9],
$costs_Ch2Last[10]
)
}
,
statTotal_costs_Ch2_Total_Merged {
sprintf(
"%.2f kWh - %.2f € (20,74 Ct a kWh)",
ReadingsNum($NAME,"total_consumption_Ch2",0)/1000,
ReadingsNum($NAME,"total_consumption_Ch2",0)/1000*0.2074
)
}
,
statTotal_costs_Total_Merged_Ch1_Ch2 {
sprintf(
"%.2f kWh - %.2f € %s",
ReadingsNum($NAME,"total_consumption_Ch1",0)/1000+ReadingsNum($NAME,"total_consumption_Ch2",0)/1000,
ReadingsNum($NAME,"total_consumption_Ch1",0)/1000*0.1817+ReadingsNum($NAME,"total_consumption_Ch2",0)/1000*0.2074,
"(NT=18,17 Ct + HT=20,74 Ct)"
)
}
Das minInterval zieht nur falls sich der Wert nicht geändert hat, wenn ich mich recht erinnere. Ich logge solche Werte garnicht automatisch sondrn schiebe sie über addLog einmal täglich "manuell" ins Log
Kurz, weil mobil
Hallo,
KernSani hat recht, allerdings habe ich gerade gesehen, dass dieser Hinweis in der Commandref lediglich bei DbLogExclude geschrieben steht:
Zitat
Ist MinIntervall angegeben, so wird der Logeintrag nur dann nicht geloggt, wenn das Intervall noch nicht erreicht und der Wert des Readings sich nicht verändert hat.
Ich bessere es im Modul nach.
Für addLog gibt es einen eingebauten Befehl im DbLog:
set <name> addLog ...
Die genaue Optionsspezifikation bitte der Commandref entnehmen.
Grüße,
Heiko
Das würde heißen ich müsste für jeden Log ein extra AT anlegen?! ???
Ist das nicht ein wenig viel overhead, wenn es das DBLoginclude eigentlich so machen müsste?!
Kann man ja alles in ein at schreiben
Kurz, weil mobil
ZitatDas würde heißen ich müsste für jeden Log ein extra AT anlegen?!
Wie KernSani schrieb ... und die addLog-Optionen sind recht mächtig und können durchaus mehrere Devices loggen. Stichwort devspec.
ZitatIst das nicht ein wenig viel overhead, wenn es das DBLoginclude eigentlich so machen müsste?!
DBLoginclude macht es ja, nur wünschen andere User eben dass Änderungen geloggt werden auch wenn das MinIntervall noch nicht erreicht ist. Das addLog richtet man einmal in ein paar Minuten ein und dann läuft das. Ist kein Problem.
Zitat von: KernSani am 09 Februar 2019, 12:47:05
Kann man ja alles in ein at schreiben
Kurz, weil mobil
Das wäre ja wenigstens etwas.
Leider bin ich ein absoluter Syntaxschussel.
So schreibt er jedenfalls nur das erste.
DEF *00:00:00 set DBLogging addLog Zaehler_WP:total_consumption_clear_Wh !useExcludes ;;
set DBLogging addLog Zaehler_WP:total_consumption_Ch1_clear_Wh !useExcludes ;;
set DBLogging addLog Zaehler_WP:total_consumption_Ch2_clear_Wh !useExcludes ;;
set DBLogging addLog Zaehler_HS:total_consumption_clear_Wh !useExcludes
Wie wärs denn damit ?
*00:00:00 set DBLogging addLog (Zaehler_WP|Zaehler_HS):total_consumption.*_clear_Wh !useExcludes
Zitat von: DS_Starter am 09 Februar 2019, 13:22:06
Wie wärs denn damit ?
*00:00:00 set DBLogging addLog (Zaehler_WP|Zaehler_HS):total_consumption.*_clear_Wh !useExcludes
So ists natürlich sehr hübsch. Danke.
Das oben hat auch funktioniert, nachdem ich gelesen habe, dass man im Editor das ; nicht maskieren muss. ::)
Prima :)
Aber aus der Aufgabenstellung nehme ich mal für mich mit, ob es vielleicht sinnvoll (und leicht verständlich) wäre hinter dem Minintervall einen "Force"-Parameter mitgebbar zu machen. Etwa in dieser Art:
DbLogInclude power_clear:60:1,total_consumption_clear_Wh:86400:1,total_consumption_Ch1_clear_Wh:86400:1,total_consumption_Ch2_clear_Wh:86400:1
Wäre "Force" gesetzt, würde MinIntervall unbedingt eingehalten -> "forced". Das würde das bisherige Verhalten nicht brechen, was wichtig ist !
Ich durchdenke mir das mal wenn ich mich wieder mit DbLog beschäftige.
Grüße
Heiko
Zitat von: DS_Starter am 09 Februar 2019, 13:38:35
Prima :)
Aber aus der Aufgabenstellung nehme ich mal für mich mit, ob es vielleicht sinnvoll (und leicht verständlich) wäre hinter dem Minintervall einen "Force"-Parameter mitgebbar zu machen. Etwa in dieser Art:
DbLogInclude power_clear:60:1,total_consumption_clear_Wh:86400:1,total_consumption_Ch1_clear_Wh:86400:1,total_consumption_Ch2_clear_Wh:86400:1
Wäre "Force" gesetzt, würde MinIntervall unbedingt eingehalten -> "forced". Das würde das bisherige Verhalten nicht brechen, was wichtig ist !
Ich durchdenke mir das mal wenn ich mich wieder mit DbLog beschäftige.
Grüße
Heiko
Hort sich nach einer brauchbaren Lösung an. :) +1
Hallo,
hat zwar etwas länger gedauert, aber nun habe ich die hier diskutierte Möglichkeit testweise umgesetzt.
Siehe -> https://forum.fhem.de/index.php/topic,65860.msg971795.html#msg971795
Grüße,
Heiko