2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

HMtemplate:pctSlat

git-svn-id: https://svn.fhem.de/fhem/trunk@15088 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2017-09-17 18:02:57 +00:00
parent d833bfd7e1
commit 2c4ea3955f

View File

@ -126,9 +126,35 @@ sub HMtemplate_Attr(@) {#######################################################
$attr{$name}{"Reg_".$rN} = $param[$no];
}
#remove old params
if ($attr{$name}{tpl_params}){# first setting
my @atS;
foreach my $atS (split(" ",$modules{HMtemplate}{AttrList})){
if ($atS !~ m/:/){# no values
push @atS,$atS;
next;
}
my ($aN,$aV) = split (":",$atS);
my @aVaNew;
foreach my $curAV(split(",",$aV)){
next if (!$curAV);
foreach my $curParam (split(",",$attr{$name}{tpl_params})){
push @aVaNew,$_ if($curAV ne $curParam);
}
}
push @atS,"$aN:".join(",",@aVaNew);
}
$modules{HMtemplate}{AttrList} = join(" ",sort @atS);
}
#now add new ones
my $paramSnew = join(",",@param);
my @at = split(" ",$modules{HMtemplate}{AttrList});
$_ .= ",".$paramSnew foreach (grep (m/:/,@at));
my $paramSold = join(",",split(" ",$attr{$name}{tpl_params}));
$modules{HMtemplate}{AttrList} =~ s/$paramSold/$paramSnew/g;
#$modules{HMtemplate}{AttrList} =~ s/$paramSold/$paramSnew/g;
$modules{HMtemplate}{AttrList} = join(" ",@at);
Log 1,"General \n $paramSnew\n $paramSold".join("\n ".split(" ","$modules{HMtemplate}{AttrList}"));
$hash->{tpl_Param} = $attrVal;
}