mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +00:00
HMtemplate: verify value setting for Register
git-svn-id: https://svn.fhem.de/fhem/trunk@15743 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
87e5f202a4
commit
b99a628149
@ -90,14 +90,17 @@ sub HMtemplate_Attr(@) {#######################################################
|
|||||||
#burstRx =>{min=>0,max=>255 ,c=>'lit',f=>'',t=>'device reacts on Burst' ,lit=>{off=>0,on=>1}},
|
#burstRx =>{min=>0,max=>255 ,c=>'lit',f=>'',t=>'device reacts on Burst' ,lit=>{off=>0,on=>1}},
|
||||||
#MaxTimeF =>{min=>0,max=>25.5 ,c=>'' ,f=>10,t=>"max time first direction." ,lit=>{unused=>25.5}},
|
#MaxTimeF =>{min=>0,max=>25.5 ,c=>'' ,f=>10,t=>"max time first direction." ,lit=>{unused=>25.5}},
|
||||||
my $rN = substr($attrName,4);
|
my $rN = substr($attrName,4);
|
||||||
my $ty = (InternalVal($name,"tpl_type","") eq "peer-Long")?"lg":"";
|
my $ty = (AttrVal($name,"tpl_type","") =~ m/peer-/)?"lg":""; #RegDef for long and short is identical. Just extend to any sh or lg
|
||||||
|
my $calc = $culHmRegDef->{$ty.$rN}{c};
|
||||||
if ($attr{$name}{tpl_params} && $attr{$name}{tpl_params} =~ m/\b$attrVal\b/){
|
if ($attr{$name}{tpl_params} && $attr{$name}{tpl_params} =~ m/\b$attrVal\b/){
|
||||||
# allow any parameter in any string
|
# allow any parameter in any string
|
||||||
}
|
}
|
||||||
|
elsif ($calc eq "lit"){
|
||||||
elsif ($culHmRegDef->{$ty.$rN}{c} eq "lit"){
|
|
||||||
return "value $attrVal not allowed for $rN" if (!defined $culHmRegDef->{$ty.$rN}{lit}{$attrVal});
|
return "value $attrVal not allowed for $rN" if (!defined $culHmRegDef->{$ty.$rN}{lit}{$attrVal});
|
||||||
}
|
}
|
||||||
|
elsif ($calc eq "fltCvT" ){ my $calcVal = CUL_HM_CvTflt (CUL_HM_fltCvT ($attrVal)); return "Value $attrVal not possible. Use $calcVal" if ($attrVal != $calcVal); }
|
||||||
|
elsif ($calc eq "fltCvT60"){ my $calcVal = CUL_HM_CvTflt60(CUL_HM_fltCvT60($attrVal)); return "Value $attrVal not possible. Use $calcVal" if ($attrVal != $calcVal); }
|
||||||
|
elsif ($calc eq "min2time"){ my $calcVal = CUL_HM_min2time(CUL_HM_time2min($attrVal)); return "Value $attrVal not possible. Use $calcVal" if ($attrVal != $calcVal); }
|
||||||
else{
|
else{
|
||||||
return "value $attrVal not numeric for $rN" if ($attrVal !~/^\d+?\.?\d?$/);
|
return "value $attrVal not numeric for $rN" if ($attrVal !~/^\d+?\.?\d?$/);
|
||||||
return "value $attrVal out of range for $rN :"
|
return "value $attrVal out of range for $rN :"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user