2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 01:06:04 +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:
martinp876 2017-01-21 11:55:53 +00:00
parent 46b82a4003
commit bd127b0e13

View File

@ -212,20 +212,25 @@ sub HMtemplate_GetFn($@) {#####################################################
my ($hash,$name,$cmd,@a) = @_; my ($hash,$name,$cmd,@a) = @_;
my $ret; my $ret;
$cmd = "?" if(!$cmd);# by default print options $cmd = "?" if(!$cmd);# by default print options
#------------ statistics --------------- #------------ statistics ---------------
if ($cmd eq "usage"){##print protocol-events------------------------- if($cmd eq "defineCmd"){##print protocol-events-------------------------
my ($type) = @a; my ($tN) = @a;
my $tN = InternalVal($name,"tpl_Name",undef); return "template not given" if(!defined $tN);
return "template not defined" if (!$tN || ! defined $culHmTpl->{$tN}); return "template unknown $tN" if(!defined $culHmTpl->{$tN});
$ret = HMinfo_templateUsg("","",$tN);
}
return "set hm templateDef $tN "
.join(":",split(" ",$culHmTpl->{$tN}{p}))
." \"$culHmTpl->{$tN}{t}\""
." ".join(" ",map{$_.=":".$culHmTpl->{$tN}{reg}{$_}} keys %{$culHmTpl->{$tN}{reg}})
;
}
else{ else{
my @cmdLst = my @cmdLst = ( "defineCmd"
( "usage" );
);
my $tList = ":".join(",",sort keys%{$culHmTpl});
$_ .=$tList foreach(grep/^(defineCmd)$/,@cmdLst);
$ret = "Unknown argument $cmd, choose one of ".join (" ",sort @cmdLst); $ret = "Unknown argument $cmd, choose one of ".join (" ",sort @cmdLst);
} }
@ -471,7 +476,7 @@ sub HMtemplate_save($$) {#
} }
sub HMtemplate_init(@) {# sub HMtemplate_init(@) {#
my $name = shift; my $name = shift;
return if(!defined $defs{$name}); return if(!defined $name || !defined $defs{$name});
my $hash = $defs{$name}; my $hash = $defs{$name};
delete $hash->{$_} foreach(grep /^tpl_/,keys %{$hash}); delete $hash->{$_} foreach(grep /^tpl_/,keys %{$hash});
delete $attr{$name}{$_} foreach(grep /^Reg_/,keys %{$attr{$name}});#clean the settings delete $attr{$name}{$_} foreach(grep /^Reg_/,keys %{$attr{$name}});#clean the settings