diff --git a/CHANGED b/CHANGED index 506ac48c0..e673fc89d 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +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. + - bugfix: 95_Dashboard: fix perl warnings, Forum: #127216 - bugfix: 74_GardenaSmartDevice: fix ic24,fix regex,fix state_string variable add sensor2 support, fix open + paused - bugfix: 93_DbRep: minor fix in reduceLog diff --git a/FHEM/95_Dashboard.pm b/FHEM/95_Dashboard.pm index 3ef9dfaa1..742674177 100644 --- a/FHEM/95_Dashboard.pm +++ b/FHEM/95_Dashboard.pm @@ -4,7 +4,7 @@ # # written and released by Sascha Hermann 2013 # -# maintained 2019-2020 by Heiko Maaz +# maintained 2019-2022 by Heiko Maaz # e-mail: Heiko dot Maaz at t-online dot de # # This script is part of fhem. @@ -56,6 +56,7 @@ use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW # Versions History intern our %Dashboard_vNotesIntern = ( + "3.17.2" => "10.04.2022 fix perl warnings, Forum: #127216 ", "3.17.1" => "10.02.2020 fix perl warning, Forum: https://forum.fhem.de/index.php/topic,16503.msg1023004.html#msg1023004 ", "3.17.0" => "06.10.2019 Path handling of backgroundimage changed ", "3.16.0" => "04.10.2019 new attribute dashboard_hideGroupHeader, commandref revised ", @@ -182,13 +183,16 @@ sub Dashboard_Set($@) { if ( $cmd eq "lock" ) { readingsSingleUpdate ($hash, "lockstate", "lock", 0); return; - } elsif ( $cmd eq "unlock" ) { + } + elsif ( $cmd eq "unlock" ) { readingsSingleUpdate ($hash, "lockstate", "unlock", 0); return; - } elsif ( $cmd eq "activateTab" ) { + } + elsif ( $cmd eq "activateTab" ) { Dashboard_activateTab ($name,$args[0]); return; - } else { + } + else { return $setlist; } @@ -220,30 +224,35 @@ sub Dashboard_Get($@) { my @iconFolders = split(":", AttrVal($FW_wname, "iconPath", "$FW_sp:default:fhemSVG:openautomation")); my $iconDirs = ""; - foreach my $idir (@iconFolders) {$iconDirs .= "$attr{global}{modpath}/www/images/".$idir.",";} + for my $idir (@iconFolders) {$iconDirs .= "$attr{global}{modpath}/www/images/".$idir.",";} $res .= " \"icondirs\": \"$iconDirs\", \"dashboard_tabcount\": " . Dashboard_GetTabCount($hash, 0). ", \"dashboard_homeTab\": " . Dashboard_GetActiveTab($name); $res .= ($i != $x) ? ",\n" : "\n"; - foreach my $attr (sort keys %$attrdata) { + for my $attr (sort keys %$attrdata) { $i++; @splitattr = split("@", $attrdata->{$attr}); + if (@splitattr == 2) { $res .= " \"".Dashboard_Escape($attr)."\": \"".$splitattr[0]."\",\n"; $res .= " \"".Dashboard_Escape($attr)."color\": \"".$splitattr[1]."\""; - } elsif ($attr ne "dashboard_homeTab") { + } + elsif ($attr ne "dashboard_homeTab") { $res .= " \"".Dashboard_Escape($attr)."\": \"".$attrdata->{$attr}."\""; - } else { + } + else { next; } + $res .= ($i != $x) ? ",\n" : "\n"; } + $res .= " }\n"; $res .= "}\n"; return $res; - } - - } elsif ($arg eq "groupWidget") { + } + } + elsif ($arg eq "groupWidget") { #### Comming Soon ###### # For dynamic load of GroupWidgets from JavaScript #my $dbgroup = ""; @@ -255,18 +264,18 @@ sub Dashboard_Get($@) { #$res .= Dashboard_BuildGroupWidgets(1,1,1212,trim($dbgroup),"t1c1,".trim($dbgroup).",true,0,0:"); #return $res; #For dynamic loading of tabs - - } elsif ($arg eq "tab" && $arg2 =~ /^\d+$/) { + } + elsif ($arg eq "tab" && $arg2 =~ /^\d+$/) { return Dashboard_BuildDashboardTab($arg2, $hash->{NAME}); - - } elsif ($arg eq "icon") { + } + elsif ($arg eq "icon") { shift @a; shift @a; return "Please provide only one icon whose path and full name is to show." if(!@a || $a[1]); my $icon = join (' ', @a); - return FW_iconPath($icon); - - } else { + return FW_iconPath($icon); + } + else { return "Unknown argument $arg choose one of config:noArg icon"; } } @@ -304,11 +313,14 @@ sub Dashboard_Attr($$$) { if ($aName =~ m/dashboard_(.*)backgroundimage/) { my $ct = ""; + if (!$1) { $ct = "MAIN"; - } else { + } + else { $ct = $1; } + delete $hash->{HELPER}{BIMG}{$ct}; if($cmd eq "set") { Dashboard_searchImage($name, "$FW_dir/images", $aVal,$ct); @@ -363,7 +375,7 @@ return $ret; # Common Start ############################################################################################# sub Dashboard_CGI($) { - my ($htmlarg) = @_; + my $htmlarg = shift; $htmlarg =~ s/^\///; # eliminate leading / my @params = split(/\//,$htmlarg); # split URL by / @@ -378,12 +390,14 @@ sub Dashboard_CGI($) { if ($showfullsize) { if ($FW_RET =~ m/
]*class="([^"]+)"[^>]*>/) { $FW_RET =~ s/class="$1"/class="$1 dashboard_fullsize"/; - } else { + } + else { $FW_RET =~ s/{HELPER}{VERSION}; @@ -469,7 +483,8 @@ sub Dashboard_SummaryFN ($$$$) { for (my $i=0;$i<@tabsortings;$i++){ if (($tabsortings[$i-1] !~ /[0-9]+/ || $tabsortings[$i-1] !~ /:/ || $tabsortings[$i-1] !~ /,/ ) && ($tabsortings[$i-1] ne "," && $tabsortings[$i-1] ne "")) { Log3 ($name, 3, "Dashboard $name - Value of attribut dashboard_tab".$i."sorting is wrong. Saved sorting can not be set. Fix Value or delete the Attribute. [".$tabsortings[$i-1]."]"); - } else { + } + else { Log3 ($name, 5, "Dashboard $name - Sorting OK or Empty: dashboard_tab".$i."sorting"); } } @@ -546,8 +561,8 @@ sub Dashboard_SummaryFN ($$$$) { $ret .= ""; $ret .= "\n"; $ret .= "\n"; - - } else { + } + else { $ret .= "".$hash->{TYPE}." | |||||||||||||
|