diff --git a/FHEM/98_DOIF.pm b/FHEM/98_DOIF.pm index 57bfd75f1..1495206d5 100644 --- a/FHEM/98_DOIF.pm +++ b/FHEM/98_DOIF.pm @@ -1457,6 +1457,7 @@ sub collect_setValue } } + sub EvalAllDoIf($$) { my ($hash,$tailBlock)= @_; @@ -1863,7 +1864,7 @@ sub ReplaceAllReadingsDoIf AddRegexpTriggerDoIf($hash,"event_Readings",$1,$id); } } - } elsif ($block =~ /^"([^"]*)"/) { + } elsif ($block =~ /^"([^"]*)"/ and $condition != -5 and $condition != -6) { ($block,$err)=ReplaceEventDoIf($block); return ($block,$err) if ($err); if ($trigger) { @@ -1937,6 +1938,8 @@ sub ReplaceAllReadingsDoIf } } } else { + ($block,$err)=ReplaceAllReadingsDoIf($hash,$block,$condition,$eval,$id); + return ($block,$err) if ($err); $block="[".$block."]"; } } @@ -4542,103 +4545,21 @@ sub get_color { return(int($color),$minColor,$maxColor); } -sub card -{ - my ($collect,$header,$icon,$min,$max,$minColor,$maxColor,$unit,$func,$decfont,$prop,$model,$lightness) = @_; +sub footer { - if (!defined $collect or !defined ${$collect}{hours}) { - return(""); - } - my $val=${$collect}{value}; - my $a=@{$collect}{values}; - my $maxVal = ${$collect}{max_value}; - my $maxValTime = ${$collect}{max_value_time}; - my $maxValSlot = ${$collect}{max_value_slot}; - my $last_value=${$collect}{last_value}; - my $minVal = ${$collect}{min_value}; - my $minValTime = ${$collect}{min_value_time}; - my $minValSlot = ${$collect}{min_value_slot}; - my $hours = ${$collect}{hours}; - my $time = ${$collect}{time}; - my $bheight=88; - my $htrans=0; - my $dim=${$collect}{dim}; + +} - - my $out; - my ($ic,$iscale,$ix,$iy,$rotate); - my ($size,$plot,$steps,$noFooter,$noColor,$hring,$bwidth); - ($size,$plot,$steps,$noFooter,$noColor,$hring,$bwidth)=split (/,/,$prop) if (defined $prop); - $plot = "" if (!defined $plot); - $steps = "" if (!defined $steps); - $noFooter = "" if (!defined $noFooter); - $noColor = "" if (!defined $noColor); - $bwidth=160 if (!defined $bwidth or $bwidth eq ""); - $hring = "" if (!defined $hring); - - my $chart_dim= $hring eq "1" ? $bwidth-36: $bwidth-88 ; - my $x_prop=int($chart_dim/$dim*100)/100; - - my ($dec,$fontformat,$unitformat); - ($dec,$fontformat,$unitformat)=split (/,/,$decfont) if (defined $decfont); - $fontformat="" if (!defined $fontformat); - $unitformat="" if (!defined $unitformat); - - my ($header_txt,$header_style); - ($header_txt,$header_style)=split (/,/,$header) if (defined $header); - $header_style="" if (!defined $header_style); - - my ($format,$value); - my ($lr,$lir,$lmm,$lu,$ln,$li); - ($lr,$lir,$lmm,$lu,$ln,$li)=split (/,/,$lightness) if (defined $lightness); - $unit="" if (!defined $unit); - - if (defined $header or $hring) { - $htrans = 24; - $bheight += 24; - } - - if ($noFooter) { - $bheight-=15; - } - $min=0 if (!defined $min); - $max=100 if (!defined $max); - $dec=1 if (!defined $dec); +sub plot { - ($format,$value,$val)=format_value($val,$min,$dec); - - $minVal=$value if (!defined $minVal); - $maxVal=$value if (!defined $maxVal); - - ##if (defined $last_value) { - ## if ($last_value> $maxVal) { - ## $maxVal=$last_value; - ## } elsif ($last_value < $minVal) { - ## $minVal=$last_value; - ## } - ##} - - ##$value=$max if($value>$max); - ##$value=$min if ($value<$min); - - $size=130 if (!defined $size or $size eq ""); - - - my ($maxValColor)=get_color($maxVal,$min,$max,$minColor,$maxColor,$func); - my ($minValColor)=get_color($minVal,$min,$max,$minColor,$maxColor,$func); - - if (defined ($icon)) { - ($ic,$iscale,$ix,$iy,$rotate)=split(",",$icon); - $rotate=0 if (!defined $rotate); - $iscale=1 if (!defined $iscale); - $ic="" if (!defined($ic)); - } - - my $svg_width=int($size/100*$bwidth); - my $svg_height=int($size/100*$bheight); + my ($collect,$min_a,$max_a,$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$footerPos,$fill,$pos,$anchor,$fillColor)=@_; + my $points=""; + my $v; + my $last; + my $out=""; my $xpos; my $nullColor; my $nullProp; @@ -4650,6 +4571,40 @@ sub card my $minPlot; my $maxPlot; my $scaling=0; + + my $val=${$collect}{value}; + my $a=@{$collect}{values}; + my $minVal = ${$collect}{min_value}; + my $maxVal = ${$collect}{max_value}; + my $maxValTime = ${$collect}{max_value_time}; + my $maxValSlot = ${$collect}{max_value_slot}; + my $last_value=${$collect}{last_value}; + my $minValTime = ${$collect}{min_value_time}; + my $minValSlot = ${$collect}{min_value_slot}; + my $hours = ${$collect}{hours}; + my $time = ${$collect}{time}; + my $dim=${$collect}{dim}; + + + my $min; + my $max; + if (ref($min_a) eq "ARRAY") { + $min=${$min_a}[0]; + $minVal=${$min_a}[1]; + $max=${$max_a}[0]; + $maxVal=${$max_a}[1]; + } else { + $min=$min_a; + $max=$max_a; + } + my ($format,$value); + ($format,$value,$val)=format_value($val,$min,$dec); + + $minVal=$value if (!defined $minVal); + $maxVal=$value if (!defined $maxVal); + + ##my ($maxValColor)=get_color($maxVal,$min,$max,$minColor,$maxColor,$func); + ##my ($minValColor)=get_color($minVal,$min,$max,$minColor,$maxColor,$func); if ($plot ne "1" and $minVal ne $maxVal) { $scaling=1; @@ -4677,50 +4632,272 @@ sub card my ($m,$n)=m_n($minPlot,0,$maxPlot,50); my $currColor; ($currColor,$minColor,$maxColor)=get_color($value,$min,$max,$minColor,$maxColor,$func); + + $maxVal=${$collect}{max_value}; + $minVal=${$collect}{min_value}; + $minVal=$value if (!defined $minVal); + $maxVal=$value if (!defined $maxVal); + my $opacity=0.2; if ($minPlot < 0 and $maxPlot > 0) { $xpos=50-int($n*10)/10; $topVal=($maxVal > 0 ? $maxVal : 0); $bottomVal=($minVal < 0 ? $minVal : 0); ($nullColor)=get_color(0,$min,$max,$minColor,$maxColor,$func); $nullProp=int ($topVal/($topVal-$bottomVal)*100)/100 if ($bottomVal<0 and $topVal>0); - $topOpacity=($topVal==0 ? 0 : 0.25); - $bottomOpacity=($bottomVal==0 ? 0: 0.25); + $topOpacity=($topVal==0 ? 0 : $opacity); + $bottomOpacity=($bottomVal==0 ? 0: $opacity); $nullOpacity=0.0; } elsif ($maxPlot <= 0) { $xpos=0; $topVal=$maxPlot; - $topOpacity=0.0; - $bottomOpacity=0.25; + $topOpacity=0; + $bottomOpacity=$opacity; $bottomVal=$minVal; } else { $xpos=50; $topVal=$maxVal; - $topOpacity=0.25; - $bottomOpacity=0.0; + $topOpacity=$opacity; + $bottomOpacity=0; $bottomVal=$minPlot; } - $ic="$ic\@".color($currColor,$ln) if (defined($icon) and $icon !~ /@/); - my ($topValColor)=get_color($topVal,$min,$max,$minColor,$maxColor,$func); my ($bottomValColor)=get_color($bottomVal,$min,$max,$minColor,$maxColor,$func); - $out.= sprintf ('',$bwidth,$bheight,$svg_width,$svg_height,$svg_width,$svg_height); + + my ($maxValColor)=get_color(${$collect}{max_value},$min,$max,$minColor,$maxColor,$func); + my ($minValColor)=get_color(${$collect}{min_value},$min,$max,$minColor,$maxColor,$func); + $out.= ''; - $out.= ''; - $out.= sprintf('',$topValColor,$bottomValColor,(defined $lr ? $lr:0)); + $out.= sprintf('',$topValColor,$bottomValColor,(defined $lr ? $lr:0)); + $out.= sprintf('',color($topValColor,$lr),$topOpacity); + $out.= sprintf('',$nullProp,color($nullColor,$lr),$nullOpacity) if (defined $nullProp); + $out.= sprintf('',color($bottomValColor,$lr),$bottomOpacity); + $out.= sprintf('',$topValColor,$bottomValColor,(defined $lr ? $lr:0)); for (my $i=0; $i<=1;$i+=0.10) { my ($color)=get_color(($topVal-$bottomVal)*(1-$i)+$bottomVal,$min,$max,$minColor,$maxColor,$func); $out.= sprintf('',$i,color($color,$lr)); } $out.= ''; - - $out.= sprintf('',$topValColor,$bottomValColor,(defined $lr ? $lr:0)); - $out.= sprintf('',color($topValColor,$lr),$topOpacity); - $out.= sprintf('',$nullProp,color($nullColor,$lr),$nullOpacity) if (defined $nullProp); - $out.= sprintf('',color($bottomValColor,$lr),$bottomOpacity); $out.= ''; + if ($noColor ne "-1") { + for (my $i=0;$i<=4;$i++) { + my $v=($maxPlot-$minPlot)*(1-$i*0.25)+$minPlot; + my ($color)= get_color($v,$min,$max,$minColor,$maxColor,$func); + $out.= sprintf('%s',$anchor,$pos,$i*12.5+2,$noColor eq "1" ? "#CCCCCC":color($color,$lmm),"",sprintf($format,$v)); + } + } + + my $j=0; + if (@{$a} > 0) { + if (!defined ${$a}[0]) { + if (defined $last_value) { + $v=$last_value; + } else { + for ($j=0;$j<@{$a};$j++) { + if (defined ${$a}[$j]) { + $v=${$a}[$j]; + last; + } + } + } + } else { + $v=${$a}[0]; + } + + $points.=$j*$x_prop.",$xpos "; + $last=(50-int(($v*$m+$n)*10)/10); + $points.=$j*$x_prop.",$last "; + $j++; + + for (my $i=$j;$i<@{$a};$i++) { + if (defined ${$a}[$i]) { + $points.=$i*$x_prop.",$last " if (!defined ${$a}[$i-1] or $steps eq "1"); + $last=(50-int((${$a}[$i]*$m+$n)*10)/10); + $points.=$i*$x_prop.",$last "; + } + } + if ($val ne "N/A") { + $points.=$chart_dim.",".$last." " if ($steps eq "1"); + $points.=$chart_dim.",".(50-int(($val*$m+$n)*10)/10)." "; + } + $out.=sprintf('',$topValColor,$bottomValColor,(defined $lr ? $lr:0),$topValColor,$bottomValColor,(defined $lr ? $lr:0)); + } else { + $out.= sprintf('" style="fill:none; stroke:url(#gradplot_%s_%s_%s);stroke-width:0.5" />',$topValColor,$bottomValColor,(defined $lr ? $lr:0)); + } + #$out.=sprintf('',$fillColor); + + } + $out.=sprintf('',$xpos,$chart_dim,$xpos); + + $out.=sprintf('',$maxValSlot*$x_prop,(50-int((${$a}[$maxValSlot]*$m+$n)*10)/10),color($maxValColor,$ln)) if (defined $maxValSlot); + $out.=sprintf(',',$minValSlot*$x_prop,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10),color($minValColor,$ln)) if (defined $minValSlot); + $out.=sprintf(' ',$chart_dim,(50-int(($value*$m+$n)*10)/10),color($currColor,$ln)) if ($val ne "N/A"); + + my $footer=""; + + if ($footerPos) { + if (defined $maxValTime) { + if ($hours > 168) { + $footer.= sprintf('▲%s',$footerPos,::strftime("%d.%m %H:%M",localtime($maxValTime))); + } else { + $footer.= sprintf('▲%s',$footerPos,::strftime("%a %H:%M",localtime($maxValTime))); + } + $footer.= sprintf('%s',$bwidth/2+7,$footerPos,color($maxValColor,$lmm),"",sprintf($format,${$collect}{max_value})); + } + if (defined $minValTime) { + if ($hours > 168) { + $footer.= sprintf('•▼%s',$bwidth/2+9,$footerPos,::strftime("%d.%m %H:%M",localtime($minValTime))); + } else { + $footer.= sprintf('•▼%s',$bwidth/2+9,$footerPos,::strftime("%a %H:%M",localtime($minValTime))); + } + $footer.= sprintf('%s', $bwidth+7,$footerPos,color($minValColor,$lmm),"",sprintf($format,${$collect}{min_value})); + } + } + + return($out,$footer); +} + + +sub card +{ + my ($col,$header,$icon,$min,$max,$minColor,$maxColor,$unit_a,$func,$decfont,$prop,$model,$lightness,$collect2,$min2,$max2,$minColor2,$maxColor2,$unit2,$func2,$decfont2) = @_; + + if (!defined $col) { + return(""); + } + + + my $collect; + if (ref($col) eq "ARRAY") { + $collect=${$col}[0]; + } else { + $collect=$col; + } + + my $unit; + if (ref($unit_a) eq "ARRAY") { + $unit=${$unit_a}[0]; + } else { + $unit=$unit_a; + } + + if (!defined ${$collect}{hours}) { + return(""); + } + + my $hours = ${$collect}{hours}; + my $time = ${$collect}{time}; + my $dim=${$collect}{dim}; + + my $bheight=73; + my $htrans=0; + + + my $out; + my ($ic,$iscale,$ix,$iy,$rotate); + + my ($size,$plot,$steps,$noFooter,$noColor,$hring,$bwidth); + ($size,$plot,$steps,$noFooter,$noColor,$hring,$bwidth)=split (/,/,$prop) if (defined $prop); + $plot = "" if (!defined $plot); + $steps = "" if (!defined $steps); + $noFooter = "" if (!defined $noFooter); + $noColor = "" if (!defined $noColor); + $hring = "" if (!defined $hring); + + if (!defined $bwidth or $bwidth eq "") { + $bwidth=180; + } + + + my $chart_dim = $hring eq "1" ? $bwidth-36: $bwidth-90 ; + + $chart_dim -= defined $collect2 ? ($hring eq "1" ? 13 : 15):0; + + my $x_prop=int($chart_dim/$dim*100)/100; + + my ($dec,$fontformat,$unitformat); + ($dec,$fontformat,$unitformat)=split (/,/,$decfont) if (defined $decfont); + $fontformat="" if (!defined $fontformat); + $unitformat="" if (!defined $unitformat); + + my ($dec2,$fontformat2,$unitformat2); + ($dec2,$fontformat2,$unitformat2)=split (/,/,$decfont2) if (defined $decfont2); + $fontformat2="" if (!defined $fontformat2); + $unitformat2="" if (!defined $unitformat2); + + my ($header_txt,$header_style); + ($header_txt,$header_style)=split (/,/,$header) if (defined $header); + $header_txt="" if (!defined $header_txt); + $header_style="" if (!defined $header_style); + + my ($lr,$lir,$lmm,$lu,$ln,$li); + ($lr,$lir,$lmm,$lu,$ln,$li)=split (/,/,$lightness) if (defined $lightness); + $unit="" if (!defined $unit); + + if (defined $header or $hring) { + $htrans = 24; + $bheight += 24; + } + + if ($noFooter ne "1") { + $bheight += 15; + if (ref ($col) eq "ARRAY") { + $bheight += (@{$col}-1)*10; + } + if (defined $collect2) { + $bheight += 10; + } + } + + $min=0 if (!defined $min); + $max=100 if (!defined $max); + $min2=0 if (!defined $min2); + $max2=100 if (!defined $max2); + $dec=1 if (!defined $dec); + $dec2=1 if (!defined $dec2); + $size=130 if (!defined $size or $size eq ""); + + if (defined ($icon)) { + ($ic,$iscale,$ix,$iy,$rotate)=split(",",$icon); + $rotate=0 if (!defined $rotate); + $iscale=1 if (!defined $iscale); + $ic="" if (!defined($ic)); + } + + my $svg_width=int($size/100*$bwidth); + my $svg_height=int($size/100*$bheight); + + my $currColor; + ($currColor,$minColor,$maxColor)=get_color(${$collect}{value},$min,$max,$minColor,$maxColor,$func); + + ##$ic="$ic\@".color($currColor,$ln) if (defined($icon) and $icon !~ /@/); + + if (defined $icon and $icon ne "") { + if ($ic !~ /@/) { + $ic="$ic\@".color($currColor,$li); + } elsif ($ic =~ /^(.*\@)colorVal1/) { + $ic="$1".color($currColor,$li); + } elsif ($ic =~ /^(.*\@)colorVal2/) { + if (defined $collect2) { + my ($currColor2)=get_color(${$collect2}{value},$min2,$max2,$minColor2,$maxColor2,$func2); + $ic="$1".color($currColor2,$li); + } + } + } + + + $out.= sprintf ('',$bwidth,$bheight,$svg_width,$svg_height,$svg_width,$svg_height); + $out.= ''; + $out.= ''; + $out.= ''; + $out.= sprintf('',$bwidth-2,$bheight); @@ -4740,36 +4917,38 @@ sub card $out.=''; } $out.=''; - if ($hring) { - $out.=sprintf('',$chart_dim); - $out.= ui_Table::ring($val,$min,$max,$minColor,$maxColor,$unit,"70,1",$func,$decfont,$model,$lightness,undef, undef); + if ($hring eq "1") { + if (ref($col) eq "ARRAY") { + for (my $i=0;$i< @{$col};$i++) { + $out.=sprintf('',defined $collect2 ? $bwidth-35-(@{$col}-$i)*21.5:$bwidth+7-(@{$col}-$i)*43); + $out.= ui_Table::ring(${$col}[$i]{value},$min,$max,$minColor,$maxColor,ref ($unit_a) eq "ARRAY" ? ${$unit_a}[$i]:$unit ,"70,1",$func,$decfont,$model,$lightness,undef,undef); + $out.=''; + } + } else { + $out.=sprintf('',defined $collect2 ? $bwidth-78:$bwidth-35); + $out.= ui_Table::ring(${$collect}{value},$min,$max,$minColor,$maxColor,$unit,"70,1",$func,$decfont,$model,$lightness,undef,undef); + $out.=''; + } + if (defined $collect2) { + $out.=sprintf('',$bwidth-35); + $out.= ui_Table::ring(${$collect2}{value},$min2,$max2,$minColor2,$maxColor2,$unit2,"70,1",$func2,$decfont2,$model,$lightness,undef, undef); + } $out.=''; } } $out.= sprintf('',$htrans); $out.='' if (!$noFooter); - $out.= sprintf('',$chart_dim+44); + $out.= sprintf('',$chart_dim+84); $out.= ''; - my $points=""; - my $v; - my $last; - - ##$out.= ''; - $out.= ''; + $out.= ''; for (my $i=1;$i<4;$i++) { my $y=$i*12.5; $out.=sprintf('',$y,$chart_dim,$y); } - for (my $i=0;$i<=4;$i++) { - my $v=($maxPlot-$minPlot)*(1-$i*0.25)+$minPlot; - my ($color)= get_color($v,$min,$max,$minColor,$maxColor,$func); - $out.= sprintf('%s',$i*12.5+2,$noColor ? "#CCCCCC":color($color,$lmm),"",sprintf($format,$v)); - } - my $timebeginn=$time-$hours*3600; my $scale; @@ -4828,75 +5007,55 @@ sub card } } } - - my $j=0; - if (@{$a} > 0) { - if (!defined ${$a}[0]) { - if (defined $last_value) { - $v=$last_value; - } else { - for ($j=0;$j<@{$a};$j++) { - if (defined ${$a}[$j]) { - $v=${$a}[$j]; - last; - } - } - } - } else { - $v=${$a}[0]; + + my ($outplot,$outfooter); + my @outfooter; + + if (ref($col) eq "ARRAY") { + my $minVal; + my $maxVal; + for (my $i=0;$i< @{$col};$i++) { + my $min=defined ${$col}[$i]{min_value} ? ${$col}[$i]{min_value} : ${$col}[$i]{value}; + my $max=defined ${$col}[$i]{max_value} ? ${$col}[$i]{max_value} : ${$col}[$i]{value}; + $minVal=$min if (!defined $minVal or $min < $minVal); + $maxVal=$max if (!defined $maxVal or $max > $maxVal); } - - $points.=$j*$x_prop.",$xpos "; - $last=(50-int(($v*$m+$n)*10)/10); - $points.=$j*$x_prop.",$last "; - $j++; - - for (my $i=$j;$i<@{$a};$i++) { - if (defined ${$a}[$i]) { - $points.=$i*$x_prop.",$last " if (!defined ${$a}[$i-1] or $steps eq "1"); - $last=(50-int((${$a}[$i]*$m+$n)*10)/10); - $points.=$i*$x_prop.",$last "; - } + for (my $i=0;$i<@{$col};$i++) { + ($outplot,$outfooter) = plot (${$col}[$i],[$min,$minVal],[$max,$maxVal],$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim, $i ? $noColor:-1,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84+$i*10,undef,-2.5,"end"); + $out.=$outplot; + push (@outfooter,$outfooter); } - if ($val ne "N/A") { - $points.=$chart_dim.",".$last." " if ($steps eq "1"); - $points.=$chart_dim.",".(50-int(($val*$m+$n)*10)/10)." "; - } - $out.=sprintf('',$topValColor,$bottomValColor,(defined $lr ? $lr:0),$topValColor,$bottomValColor,(defined $lr ? $lr:0)); + } else { + my ($outplot,$outfooter) = plot ($collect,$min,$max,$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84,undef,-2.5,"end"); + $out.=$outplot; + push (@outfooter,$outfooter); + } + if (defined $collect2) { + ($outplot,$outfooter) = plot ($collect2,$min2,$max2,$minColor2,$maxColor2,$dec2,$func2,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84+@outfooter*10,undef,$chart_dim+3,"start"); + $out.=$outplot; + push (@outfooter,$outfooter) } - $out.=sprintf('',$xpos,$chart_dim,$xpos); - - $out.=sprintf('',$maxValSlot*$x_prop,(50-int((${$a}[$maxValSlot]*$m+$n)*10)/10),color($maxValColor,$ln)) if (defined $maxValSlot); - $out.=sprintf(',',$minValSlot*$x_prop,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10),color($minValColor,$ln)) if (defined $minValSlot); - $out.=sprintf(' ',$chart_dim,(50-int(($value*$m+$n)*10)/10),color($currColor,$ln)) if ($val ne "N/A"); $out.= ''; $out.= ''; if (!$hring) { - $out.=sprintf('',$chart_dim+39); - $out.= ui_Table::ring($val,$min,$max,$minColor,$maxColor,$unit,92,$func,$decfont,$model,$lightness,undef,(defined $header or !defined $icon) ? undef: $icon); + $out.=sprintf('',$bwidth-49); + if (!defined $collect2) { + if (ref($col) eq "ARRAY" and scalar (@{$col}) >= 2 ) { + $out.= ui_Table::ring2(${$col}[0]{value},$min,$max,$minColor,$maxColor,$unit,92,$func,$decfont,${$col}[1]{value},$min,$max,$minColor,$maxColor,ref ($unit_a) eq "ARRAY" ? ${$unit_a}[1]:$unit,$func,$decfont,$lightness,undef,(defined $header or !defined $icon) ? undef: $icon); + } else { + $out.= ui_Table::ring(${$collect}{value},$min,$max,$minColor,$maxColor,$unit,92,$func,$decfont,$model,$lightness,undef,(defined $header or !defined $icon) ? undef: $icon); + } + } else { + $out.= ui_Table::ring2(${$collect}{value},$min,$max,$minColor,$maxColor,$unit,92,$func,$decfont,${$collect2}{value},$min2,$max2,$minColor2,$maxColor2,$unit2,$func2,$decfont2,$lightness,undef,(defined $header or !defined $icon) ? undef: $icon); + } $out.=''; $out.=sprintf('%s',$bwidth-21,::strftime("%H:%M:%S",localtime($time))); } - + if ($noFooter ne "1") { - if (defined $maxValTime) { - if ($hours > 168) { - $out.= sprintf('▲%s',::strftime("%d.%m %H:%M",localtime($maxValTime))); - } else { - $out.= sprintf('▲%s',::strftime("%a %H:%M",localtime($maxValTime))); - } - $out.= sprintf('%s',$bwidth/2+7,color($maxValColor,$lmm),"",sprintf($format,${$collect}{max_value})); - } - if (defined $minValTime) { - if ($hours > 168) { - $out.= sprintf('•▼%s',$bwidth/2+9,::strftime("%d.%m %H:%M",localtime($minValTime))); - } else { - $out.= sprintf('•▼%s',$bwidth/2+9,::strftime("%a %H:%M",localtime($minValTime))); - } - $out.= sprintf('%s', $bwidth+7,color($minValColor,$lmm),"",sprintf($format,${$collect}{min_value})); + for (my $i=0;$i < @outfooter;$i++) { + $out.=$outfooter[$i]; } } $out.=''; @@ -5325,9 +5484,18 @@ sub icon_temp_temp_ring { sub ring { - my ($val,$min,$max,$minColor,$maxColor,$unit,$sizeHalf,$func,$decfont,$mode,$lightness,$lnum,$icon) = @_; + my ($val_a,$min,$max,$minColor,$maxColor,$unit,$sizeHalf,$func,$decfont,$mode,$lightness,$lnum,$icon) = @_; my $out; - + my $val; + my $val_color; + + if (ref ($val_a) eq "ARRAY") { + $val=${$val_a}[0]; + $val_color=${$val_a}[1]; + } else { + $val=$val_a; + } + my ($size,$half); ($size,$half)=split (/,/,$sizeHalf) if (defined $sizeHalf); $size=100 if (!defined $size or $size eq ""); @@ -5419,7 +5587,7 @@ sub ring } } my $minCol=$minColor; - if (defined $monochrom and $monochrom==1) { + if (defined $monochrom and $monochrom eq "1") { $minColor=$currColor; } @@ -5460,9 +5628,17 @@ sub ring '; $out.=''; $out.=''; + + $out.=''; $out.=describeArc(41, 30, 28, $minArc, $maxArc); $out.=''; + + if (defined $val_color) { + $out.=sprintf('',color($val_color,$ln)); + $out.=describeArc(41, 30, 29.5, $minArc, $maxArc); + $out.=''; + } if (defined $pointer) { $out.=''; $out.=describeArc(41, 30, 28, int(($prop*($maxArc-$minArc)+$minArc-$pointer/2)*10)/10, int(($prop*($maxArc-$minArc)+$minArc+$pointer/2)*10)/10); @@ -5486,7 +5662,7 @@ sub ring $from=$to+2; } } else { - $out.=''; + ##$out.=''; $out.=sprintf('',$minCol,$maxColor,(defined $lir ? $lir:0),($innerRing eq "1" ? "":$innerRing)); $out.=describeArc(41, 30, 25.5, $minArc, $maxArc); $out.=''; @@ -5503,6 +5679,7 @@ sub ring $out.= $svg_icon; $out.=''; } + my $icflag = (defined ($icon) and $icon ne "") ? 1:0; my ($valInt,$valDec)=split(/\./,sprintf($format,$val)); @@ -5669,7 +5846,7 @@ sub ring2 $out.=sprintf('',$currColor,$minColor,(defined $lr ? $lr:0)); - $out.=describeArc(41, 30, 28.2, 0, int($prop*280)); + $out.=describeArc(41, 30, 28.2, 0,int($prop*280)); $out.=''; if (defined $icon and $icon ne "" and $icon ne " ") {