2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 14:47:00 +00:00

93_DbLog: variable $DEVICE is available in attr DbLogValueFn to have readonly access to the source device name

git-svn-id: https://svn.fhem.de/fhem/trunk@20773 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-12-17 21:41:33 +00:00
parent d750de26c1
commit 008b7dffa8
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 93_DbLog: variable $DEVICE is available in attr DbLogValueFn to
have readonly access to the source device name
- feature: 77_SMAEM: use OBIS metrics (Thx to RiG), change Readings Lx_THD
to Lx_Strom, new attribute "noCoprocess", some fixes
- feature: 49_SSCam: new attributes snapChatTxt and recChatTxt to activate

View File

@ -30,6 +30,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Version History intern by DS_Starter:
our %DbLog_vNotesIntern = (
"4.9.2" => "16.12.2019 add \$DEVICE to attr DbLogValueFn for readonly access to the device name ",
"4.9.1" => "13.11.2019 escape \ with \\ in DbLog_Push and DbLog_PushAsync ",
"4.9.0" => "11.11.2019 new attribute defaultMinInterval to set a default minInterval central in dblog for all events ".
"Forum: https://forum.fhem.de/index.php/topic,65860.msg972352.html#msg972352 ",
@ -1442,6 +1443,7 @@ sub DbLog_Log($$) {
# Device spezifische DbLogValueFn-Funktion anwenden
if($DbLogValueFn ne '') {
my $TIMESTAMP = $timestamp;
my $DEVICE = $dev_name;
my $EVENT = $event;
my $READING = $reading;
my $VALUE = $value;
@ -6981,7 +6983,8 @@ sub DbLog_showChildHandles ($$$$) {
The attribute <i>DbLogValueFn</i> will be propagated to all devices if DbLog is used.
This attribute contains a Perl expression that can use and change values of $TIMESTAMP, $READING, $VALUE (value of
reading) and $UNIT (unit of reading value). That means the changed values are logged.
You also have readonly-access to $EVENT for evaluation in your expression. <br>
You also have readonly access to $DEVICE (the source device name) and $EVENT for evaluation in your expression. <br>
$DEVICE and $EVENT cannot be changed. <br>
If $TIMESTAMP should be changed, it must meet the condition "yyyy-mm-dd hh:mm:ss", otherwise the $timestamp wouldn't
be changed.
In addition you can set the variable $IGNORE=1 if you want skip a dataset from logging. <br>
@ -8370,8 +8373,8 @@ attr SMA_Energymeter DbLogValueFn
Wird DbLog genutzt, wird in allen Devices das Attribut <i>DbLogValueFn</i> propagiert.
Es kann über einen Perl-Ausdruck auf die Variablen $TIMESTAMP, $READING, $VALUE (Wert des Readings) und
$UNIT (Einheit des Readingswert) zugegriffen werden und diese verändern, d.h. die veränderten Werte werden geloggt.
Außerdem hat man lesenden Zugriff auf $EVENT für eine Auswertung im Perl-Ausdruck.
$EVENT kann nicht verändert werden. <br>
Außerdem hat man lesenden Zugriff auf $DEVICE (den Namen des Devices) und $EVENT für eine Auswertung im Perl-Ausdruck.
$DEVICE und $EVENT kann nicht verändert werden. <br>
Soll $TIMESTAMP verändert werden, muss die Form "yyyy-mm-dd hh:mm:ss" eingehalten werden, ansonsten wird der
geänderte $timestamp nicht übernommen.
Zusätzlich kann durch Setzen der Variable "$IGNORE=1" der Datensatz vom Logging ausgeschlossen werden. <br>