From f7ef5102d55b2c7714781c7435df02ace9ef32fc Mon Sep 17 00:00:00 2001 From: Damian <> Date: Mon, 11 Apr 2022 08:24:02 +0000 Subject: [PATCH] 98_DOIF.pm: card without animation: variable $ANIMATE git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@25946 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/98_DOIF.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/FHEM/98_DOIF.pm b/FHEM/98_DOIF.pm index 77066269f..f63f6a529 100644 --- a/FHEM/98_DOIF.pm +++ b/FHEM/98_DOIF.pm @@ -445,6 +445,7 @@ sub parse_tpl $wcmd =~ s/\$SHOWNODEVICELINK/\$hash->{$table}{shownodevicelink}/; $wcmd =~ s/\$SHOWNODEVICELINE/\$hash->{$table}{shownodeviceline}/; $wcmd =~ s/\$SHOWNOUITABLE/\$hash->{$table}{shownouitable}/; + $wcmd =~ s/\$ANIMATE/\$hash->{card}{animate}/; $hash->{$table}{package} = "" if (!defined ($hash->{$table}{package})); if ($wcmd=~ /^\s*\{/) { # perl block my ($beginning,$currentBlock,$err,$tailBlock)=GetBlockDoIf($wcmd,'[\{\}]'); @@ -1692,6 +1693,7 @@ sub ReplaceReadingDoIf delete $hash->{collect}{"$name $reading"}{$hours}; $hash->{collect}{"$name $reading"}{$hours}{hours}=$hours; $hash->{collect}{"$name $reading"}{$hours}{dim}=$dim; + $hash->{collect}{"$name $reading"}{$hours}{animate}= (defined $hash->{card}{animate} and $hash->{card}{animate} eq "1") ? 1 :0; my $values=::ReadingsVal($hash->{NAME},".col_".$hash->{collect}{"$name $reading"}{$hours}{dim}."_".$name."_".$reading."_".$hours."_values",""); my $times=::ReadingsVal($hash->{NAME},".col_".$hash->{collect}{"$name $reading"}{$hours}{dim}."_".$name."_".$reading."_".$hours."_times",""); my $va; @@ -4601,7 +4603,8 @@ sub plot { my $hours = ${$collect}{hours}; my $time = ${$collect}{time}; my $dim=${$collect}{dim}; - + my $animate=(${$collect}{animate} eq "1") ? '':''; + my $min; my $max; @@ -4758,9 +4761,15 @@ sub plot { } $out.=sprintf('',$xpos,$chart_dim,$xpos); - $out.=sprintf('',$maxValSlot*$x_prop,(50-int((${$a}[$maxValSlot]*$m+$n)*10)/10),defined $unitColor ? $unitColor:color($maxValColor,$ln)) if (defined $maxValSlot); - $out.=sprintf(',',$minValSlot*$x_prop,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10),defined $unitColor ? $unitColor:color($minValColor,$ln)) if (defined $minValSlot); - $out.=sprintf(' ',$chart_dim,(50-int(($value*$m+$n)*10)/10),defined $unitColor ? $unitColor:color($currColor,$ln)) if ($val ne "N/A"); + ##$out.=sprintf('',$maxValSlot*$x_prop,(50-int((${$a}[$maxValSlot]*$m+$n)*10)/10),defined $unitColor ? $unitColor:color($maxValColor,$ln)) if (defined $maxValSlot); + my ($x1,$y1)=($maxValSlot*$x_prop,(50-int((${$a}[$maxValSlot]*$m+$n)*10)/10)-2.3); + $out.=sprintf('',$x1,$y1,$x1+2.4,$y1+4.3,$x1-2.4,$y1+4.3, defined $unitColor ? $unitColor:color($maxValColor,$ln)) if (defined $maxValSlot); + + ##$out.=sprintf(',',$minValSlot*$x_prop,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10),defined $unitColor ? $unitColor:color($minValColor,$ln)) if (defined $minValSlot); + ($x1,$y1)=($minValSlot*$x_prop,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10)+2.3); + $out.=sprintf('',$x1,$y1,$x1+2.4,$y1-4.3,$x1-2.4,$y1-4.3, defined $unitColor ? $unitColor:color($minValColor,$ln)) if (defined $minValSlot); + + $out.=sprintf((''.$animate),$chart_dim,(50-int(($value*$m+$n)*10)/10),defined $unitColor ? $unitColor:color($currColor,$ln)) if ($val ne "N/A"); my $footer=""; @@ -4968,7 +4977,7 @@ sub card $out.= sprintf('',$chart_dim+84); $out.= ''; - $out.= ''; + $out.= ''; for (my $i=1;$i<5;$i++) { my $y=$i*10;