2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

76_SMAPortal: avoid deletion of readings if provider is selected but value not delivered. Forum: #102112.msg1078990.html#msg1078990

git-svn-id: https://svn.fhem.de/fhem/trunk@22640 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-08-21 07:30:21 +00:00
parent 77daab008b
commit 900f46f4fd
2 changed files with 30 additions and 16 deletions

View File

@ -1,5 +1,8 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- change: 76_SMAPortal: avoid deletion of readings if provider is selected
but value not delivered.
Forum: #102112.msg1078990.html#msg1078990
- bugfix: 73_AutoShuttersControl: fix bug in call - bugfix: 73_AutoShuttersControl: fix bug in call
IsAfterShuttersTimeBlocking() IsAfterShuttersTimeBlocking()
- bugfix: 73_AutoShuttersControl: fix fix numeric eq - bugfix: 73_AutoShuttersControl: fix fix numeric eq

View File

@ -137,6 +137,7 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"3.4.1" => "18.08.2020 add selected providerlevel to deletion blacklist # Forum: https://forum.fhem.de/index.php/topic,102112.msg1078990.html#msg1078990 ",
"3.4.0" => "09.08.2020 attr balanceDay, balanceMonth, balanceYear for data provider balanceDayData, balanceMonthData, balanceYearData ". "3.4.0" => "09.08.2020 attr balanceDay, balanceMonth, balanceYear for data provider balanceDayData, balanceMonthData, balanceYearData ".
"set getData command, update button in header of PortalAsHtml, minor code changes according PBP", "set getData command, update button in header of PortalAsHtml, minor code changes according PBP",
"3.3.4" => "12.07.2020 fix break in header if attribute hourCount was reduced ", "3.3.4" => "12.07.2020 fix break in header if attribute hourCount was reduced ",
@ -2067,7 +2068,7 @@ sub ParseData { ## no critic
@da = split "###", $lc; @da = split "###", $lc;
} }
deleteData($hash, 0) if($getp ne "none"); # Daten nur löschen wenn Datenabruf (kein Verbraucher schalten) deleteData($hash, 1) if($getp ne "none"); # Daten nur löschen wenn Datenabruf (kein Verbraucher schalten)
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
@ -2890,7 +2891,7 @@ return;
################################################################ ################################################################
# delete Readings und Hash HELPER-Daten # delete Readings und Hash HELPER-Daten
# $conspl = providerLevel berücksichtigen # $conspl = providerLevel berücksichtigen
################################################################ ################################################################
sub deleteData { sub deleteData {
my $hash = shift; my $hash = shift;
@ -2898,11 +2899,11 @@ sub deleteData {
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my @allrds = keys%{$defs{$name}{READINGS}}; my @allrds = keys%{$defs{$name}{READINGS}};
my $bl = "state|lastCycleTime|Counter|loginState"; # Blacklist my $bl = "state|lastCycleTime|Counter|loginState"; # Blacklist
my $pblvl = $stpl{plantLogbook}{level}; # Logbuch Level my $pblvl = $stpl{plantLogbook}{level}; # Logbuch Level
if(!$subs{$name}{forecastData}{doit}) { # wenn forecastData nicht abgerufen werden sollen -> Wetterdaten im HELPER löschen if(!$subs{$name}{forecastData}{doit}) { # wenn forecastData nicht abgerufen werden sollen -> Wetterdaten im HELPER löschen
my $fclvl = $stpl{forecastData}{level}; my $fclvl = $stpl{forecastData}{level};
delete $hash->{HELPER}{"${fclvl}_ThisHour_WeatherId"}; delete $hash->{HELPER}{"${fclvl}_ThisHour_WeatherId"};
for my $i (1..23) { for my $i (1..23) {
@ -2911,22 +2912,32 @@ sub deleteData {
} }
} }
if($conspl) { # Readings löschen wenn nicht im providerLevel enthalten if($conspl) { # Readings löschen wenn nicht im providerLevel enthalten
for my $key(@allrds) { my $pbl = q{};
my ($lvl) = $key =~ m/^(L\d+)_/x; for my $prl (keys %{$mandatory{$name}}) { # mandatory Provider die abgerufen wurden
if($lvl) { my $lvlm = $mandatory{$name}{$prl}{level}; # Forum: https://forum.fhem.de/index.php/topic,102112.msg1078990.html#msg1078990
for my $p (keys %{$subs{$name}}) { if ($lvlm) {
delete($defs{$name}{READINGS}{$key}) if($subs{$name}{$p}{level} eq $lvl && !$subs{$name}{$p}{doit}); $pbl .= "|^".$lvlm."_";
}
} else {
delete($defs{$name}{READINGS}{$key}) if($key !~ /$bl/x);
} }
delete $defs{$name}{READINGS}{$key} if($key =~ /^$pblvl/x); # Logbuchreadings immer löschen
} }
for my $prl (keys %{$subs{$name}}) { # Provider die abgerufen wurden
my $lvl = $subs{$name}{$prl}{level} if($subs{$name}{$prl}{doit}); # Forum: https://forum.fhem.de/index.php/topic,102112.msg1078990.html#msg1078990
if ($lvl) {
$pbl .= "|^".$lvl."_";
}
}
$bl .= $pbl; # Blacklist ergänzen
for my $key(@allrds) {
delete($defs{$name}{READINGS}{$key}) if($key !~ /$bl/x);
delete $defs{$name}{READINGS}{$key} if($key =~ /^$pblvl/x); # Logbuchreadings immer löschen
}
return; return;
} }
for my $key(@allrds) { for my $key(@allrds) { # alle Readings löschen bis auf Standard-Blacklist
delete($defs{$name}{READINGS}{$key}) if($key !~ /$bl/x); delete($defs{$name}{READINGS}{$key}) if($key !~ /$bl/x);
} }