mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-17 23:46:03 +00:00
HMtemplate:update listing
git-svn-id: https://svn.fhem.de/fhem/trunk@13167 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
46b82a4003
commit
bd127b0e13
@ -211,22 +211,27 @@ sub HMtemplate_Notify(@){######################################################
|
||||
sub HMtemplate_GetFn($@) {#####################################################
|
||||
my ($hash,$name,$cmd,@a) = @_;
|
||||
my $ret;
|
||||
|
||||
|
||||
$cmd = "?" if(!$cmd);# by default print options
|
||||
#------------ statistics ---------------
|
||||
if ($cmd eq "usage"){##print protocol-events-------------------------
|
||||
my ($type) = @a;
|
||||
my $tN = InternalVal($name,"tpl_Name",undef);
|
||||
return "template not defined" if (!$tN || ! defined $culHmTpl->{$tN});
|
||||
$ret = HMinfo_templateUsg("","",$tN);
|
||||
}
|
||||
if($cmd eq "defineCmd"){##print protocol-events-------------------------
|
||||
my ($tN) = @a;
|
||||
return "template not given" if(!defined $tN);
|
||||
return "template unknown $tN" if(!defined $culHmTpl->{$tN});
|
||||
|
||||
return "set hm templateDef $tN "
|
||||
.join(":",split(" ",$culHmTpl->{$tN}{p}))
|
||||
." \"$culHmTpl->{$tN}{t}\""
|
||||
." ".join(" ",map{$_.=":".$culHmTpl->{$tN}{reg}{$_}} keys %{$culHmTpl->{$tN}{reg}})
|
||||
;
|
||||
}
|
||||
else{
|
||||
my @cmdLst =
|
||||
( "usage"
|
||||
);
|
||||
|
||||
my @cmdLst = ( "defineCmd"
|
||||
);
|
||||
|
||||
my $tList = ":".join(",",sort keys%{$culHmTpl});
|
||||
$_ .=$tList foreach(grep/^(defineCmd)$/,@cmdLst);
|
||||
|
||||
$ret = "Unknown argument $cmd, choose one of ".join (" ",sort @cmdLst);
|
||||
}
|
||||
return $ret;
|
||||
@ -471,7 +476,7 @@ sub HMtemplate_save($$) {#
|
||||
}
|
||||
sub HMtemplate_init(@) {#
|
||||
my $name = shift;
|
||||
return if(!defined $defs{$name});
|
||||
return if(!defined $name || !defined $defs{$name});
|
||||
my $hash = $defs{$name};
|
||||
delete $hash->{$_} foreach(grep /^tpl_/,keys %{$hash});
|
||||
delete $attr{$name}{$_} foreach(grep /^Reg_/,keys %{$attr{$name}});#clean the settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user