2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 20:52:13 +00:00

93_DbRep: minor internal code chane, commandref revised

git-svn-id: https://svn.fhem.de/fhem/trunk@20610 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-11-28 20:20:46 +00:00
parent dc4e37b8d6
commit f5bde3cf96
3 changed files with 62 additions and 52 deletions

View File

@ -1,6 +1,6 @@
# 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.
- change: 93_DbRep: minor internal code chane, commandref revised
- bugfix: 73_AutoShuttersControl: fix selfdefense bug
- bugfix: 73_AutoShuttersControl: fix time format problem
- feature: 73_DoorBird: Videos File Format as Attribute

View File

@ -58,6 +58,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Version History intern
our %DbRep_vNotesIntern = (
"8.30.3" => "28.11.2019 countEntries encode \$device, change count_ParseDone for \"countEntriesDetail\" ",
"8.30.2" => "24.11.2019 change order of delete(\$hash->{HELPER}{RUNNING_PID}) in *_ParseDone routines, Forum: https://forum.fhem.de/index.php/topic,105591.msg996089.html#msg996089 ",
"8.30.1" => "22.11.2019 commandref revised ",
"8.30.0" => "14.11.2019 new command set adminCredentials and get storedCredentials, attribute useAdminCredentials ",
@ -2917,6 +2918,7 @@ sub averval_DoParse($) {
# Daten müssen als Einzeiler zurückgegeben werden
$arrstr = encode_base64($arrstr,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -2935,7 +2937,7 @@ sub averval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $arrstr = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -3106,6 +3108,7 @@ sub count_DoParse($) {
# Daten müssen als Einzeiler zurückgegeben werden
$arrstr = encode_base64($arrstr,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3124,7 +3127,7 @@ sub count_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $arrstr = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $bt = $a[3];
my ($rt,$brt) = split(",", $bt);
@ -3162,8 +3165,12 @@ sub count_ParseDone($) {
} else {
my $ds = $device."__" if ($device);
my $rds = $reading."__" if ($reading);
# $reading_runtime_string = $rsf.$ds.$rds."COUNT_".$table."__".$runtime_string;
$reading_runtime_string = $rsf."COUNT_".$table."__".$runtime_string;
if(AttrVal($name,"countEntriesDetail",0)) {
# $reading_runtime_string = $rsf.$ds.$rds."COUNT_".$table."__".$runtime_string;
$reading_runtime_string = $rsf.$rds."COUNT_".$table."__".$runtime_string;
} else {
$reading_runtime_string = $rsf."COUNT_".$table."__".$runtime_string;
}
}
ReadingsBulkUpdateValue ($hash, $reading_runtime_string, $c?$c:"-");
@ -3328,6 +3335,7 @@ sub maxval_DoParse($) {
}
my $rowlist = encode_base64($rows,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3346,7 +3354,7 @@ sub maxval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $rowlist = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -3561,6 +3569,7 @@ sub minval_DoParse($) {
}
my $rowlist = encode_base64($rows,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3579,7 +3588,7 @@ sub minval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $rowlist = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -3898,6 +3907,7 @@ sub diffval_DoParse($) {
}
my $rowlist = encode_base64($rows,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3916,7 +3926,7 @@ sub diffval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $rowlist = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -4105,6 +4115,7 @@ sub sumval_DoParse($) {
# Daten müssen als Einzeiler zurückgegeben werden
$arrstr = encode_base64($arrstr,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -4123,7 +4134,7 @@ sub sumval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $arrstr = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -13093,22 +13104,15 @@ return $ret;
<ul>
<b>Examples:</b> <br>
<code>attr &lt;name&gt; device TYPE=DbRep</code> <br>
# select datasets of active present devices with Type "DbRep" <br>
<code>attr &lt;name&gt; device MySTP_5000</code> <br>
# select datasets of device "MySTP_5000" <br>
<code>attr &lt;name&gt; device SMA.*</code> <br>
# select datasets of devices starting with "SMA" <br>
<code>attr &lt;name&gt; device SMA_Energymeter,MySTP_5000</code> <br>
# select datasets of devices "SMA_Energymeter" and "MySTP_5000" <br>
<code>attr &lt;name&gt; device %5000</code> <br>
# select datasets of devices ending with "5000" <br>
<code>attr &lt;name&gt; device TYPE=DbRep </code> <br>
<code>attr &lt;name&gt; device MySTP_5000 </code> <br>
<code>attr &lt;name&gt; device SMA.*,MySTP.* </code> <br>
<code>attr &lt;name&gt; device SMA_Energymeter,MySTP_5000 </code> <br>
<code>attr &lt;name&gt; device %5000 </code> <br>
<code>attr &lt;name&gt; device TYPE=SSCam EXCLUDE=SDS1_SVS </code> <br>
# select datasets of devices TYPE SSCam but exclude device "SDS1_SVS" <br>
<code>attr &lt;name&gt; device TYPE=SSCam,TYPE=ESPEasy EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device EXCLUDE=SDS1_SVS </code> <br>
# select all devices except device "SDS1_SVS" <br>
<code>attr &lt;name&gt; device EXCLUDE=TYPE=SSCam </code> <br>
# select all devices except devices of TYPE "SSCam" <br>
</ul>
<br>
@ -15636,6 +15640,7 @@ return $ret;
<code>attr &lt;name&gt; device SMA_Energymeter,MySTP_5000 </code> <br>
<code>attr &lt;name&gt; device %5000 </code> <br>
<code>attr &lt;name&gt; device TYPE=SSCam EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device TYPE=SSCam,TYPE=ESPEasy EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device EXCLUDE=TYPE=SSCam </code> <br>
</ul>

View File

@ -1,5 +1,5 @@
##########################################################################################################
# $Id: 93_DbRep.pm 20563 2019-11-22 22:49:42Z DS_Starter $
# $Id: 93_DbRep.pm 20571 2019-11-24 19:17:33Z DS_Starter $
##########################################################################################################
# 93_DbRep.pm
#
@ -58,6 +58,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Version History intern
our %DbRep_vNotesIntern = (
"8.30.3" => "28.11.2019 countEntries encode \$device, change count_ParseDone for \"countEntriesDetail\" ",
"8.30.2" => "24.11.2019 change order of delete(\$hash->{HELPER}{RUNNING_PID}) in *_ParseDone routines, Forum: https://forum.fhem.de/index.php/topic,105591.msg996089.html#msg996089 ",
"8.30.1" => "22.11.2019 commandref revised ",
"8.30.0" => "14.11.2019 new command set adminCredentials and get storedCredentials, attribute useAdminCredentials ",
@ -2917,6 +2918,7 @@ sub averval_DoParse($) {
# Daten müssen als Einzeiler zurückgegeben werden
$arrstr = encode_base64($arrstr,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -2935,7 +2937,7 @@ sub averval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $arrstr = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -3106,6 +3108,7 @@ sub count_DoParse($) {
# Daten müssen als Einzeiler zurückgegeben werden
$arrstr = encode_base64($arrstr,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3124,7 +3127,7 @@ sub count_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $arrstr = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $bt = $a[3];
my ($rt,$brt) = split(",", $bt);
@ -3162,8 +3165,12 @@ sub count_ParseDone($) {
} else {
my $ds = $device."__" if ($device);
my $rds = $reading."__" if ($reading);
# $reading_runtime_string = $rsf.$ds.$rds."COUNT_".$table."__".$runtime_string;
$reading_runtime_string = $rsf."COUNT_".$table."__".$runtime_string;
if(AttrVal($name,"countEntriesDetail",0)) {
# $reading_runtime_string = $rsf.$ds.$rds."COUNT_".$table."__".$runtime_string;
$reading_runtime_string = $rsf.$rds."COUNT_".$table."__".$runtime_string;
} else {
$reading_runtime_string = $rsf."COUNT_".$table."__".$runtime_string;
}
}
ReadingsBulkUpdateValue ($hash, $reading_runtime_string, $c?$c:"-");
@ -3328,6 +3335,7 @@ sub maxval_DoParse($) {
}
my $rowlist = encode_base64($rows,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3346,7 +3354,7 @@ sub maxval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $rowlist = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -3561,6 +3569,7 @@ sub minval_DoParse($) {
}
my $rowlist = encode_base64($rows,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3579,7 +3588,7 @@ sub minval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $rowlist = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -3898,6 +3907,7 @@ sub diffval_DoParse($) {
}
my $rowlist = encode_base64($rows,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -3916,7 +3926,7 @@ sub diffval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $rowlist = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -4105,6 +4115,7 @@ sub sumval_DoParse($) {
# Daten müssen als Einzeiler zurückgegeben werden
$arrstr = encode_base64($arrstr,"");
$device = encode_base64($device,"");
# Background-Laufzeit ermitteln
my $brt = tv_interval($bst);
@ -4123,7 +4134,7 @@ sub sumval_ParseDone($) {
my $hash = $defs{$a[0]};
my $name = $hash->{NAME};
my $arrstr = decode_base64($a[1]);
my $device = $a[2];
my $device = decode_base64($a[2]);
$device =~ s/[^A-Za-z\/\d_\.-]/\//g;
my $reading = $a[3];
$reading =~ s/[^A-Za-z\/\d_\.-]/\//g;
@ -11052,12 +11063,12 @@ sub DbRep_setVersionInfo($) {
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
# META-Daten sind vorhanden
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 20563 2019-11-22 22:49:42Z DS_Starter $ im Kopf komplett! vorhanden )
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 20571 2019-11-24 19:17:33Z DS_Starter $ im Kopf komplett! vorhanden )
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
} else {
$modules{$type}{META}{x_version} = $v;
}
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 20563 2019-11-22 22:49:42Z DS_Starter $ im Kopf komplett! vorhanden )
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 20571 2019-11-24 19:17:33Z DS_Starter $ im Kopf komplett! vorhanden )
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
@ -13093,22 +13104,15 @@ return $ret;
<ul>
<b>Examples:</b> <br>
<code>attr &lt;name&gt; device TYPE=DbRep</code> <br>
# select datasets of active present devices with Type "DbRep" <br>
<code>attr &lt;name&gt; device MySTP_5000</code> <br>
# select datasets of device "MySTP_5000" <br>
<code>attr &lt;name&gt; device SMA.*</code> <br>
# select datasets of devices starting with "SMA" <br>
<code>attr &lt;name&gt; device SMA_Energymeter,MySTP_5000</code> <br>
# select datasets of devices "SMA_Energymeter" and "MySTP_5000" <br>
<code>attr &lt;name&gt; device %5000</code> <br>
# select datasets of devices ending with "5000" <br>
<code>attr &lt;name&gt; device TYPE=DbRep </code> <br>
<code>attr &lt;name&gt; device MySTP_5000 </code> <br>
<code>attr &lt;name&gt; device SMA.*,MySTP.* </code> <br>
<code>attr &lt;name&gt; device SMA_Energymeter,MySTP_5000 </code> <br>
<code>attr &lt;name&gt; device %5000 </code> <br>
<code>attr &lt;name&gt; device TYPE=SSCam EXCLUDE=SDS1_SVS </code> <br>
# select datasets of devices TYPE SSCam but exclude device "SDS1_SVS" <br>
<code>attr &lt;name&gt; device TYPE=SSCam,TYPE=ESPEasy EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device EXCLUDE=SDS1_SVS </code> <br>
# select all devices except device "SDS1_SVS" <br>
<code>attr &lt;name&gt; device EXCLUDE=TYPE=SSCam </code> <br>
# select all devices except devices of TYPE "SSCam" <br>
</ul>
<br>
@ -15636,6 +15640,7 @@ return $ret;
<code>attr &lt;name&gt; device SMA_Energymeter,MySTP_5000 </code> <br>
<code>attr &lt;name&gt; device %5000 </code> <br>
<code>attr &lt;name&gt; device TYPE=SSCam EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device TYPE=SSCam,TYPE=ESPEasy EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device EXCLUDE=SDS1_SVS </code> <br>
<code>attr &lt;name&gt; device EXCLUDE=TYPE=SSCam </code> <br>
</ul>