2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

List parameter added

git-svn-id: https://svn.fhem.de/fhem/trunk@488 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-11-25 11:13:44 +00:00
parent deef88e1ef
commit 1723aa8f94
2 changed files with 27 additions and 4 deletions

View File

@ -478,13 +478,16 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="list"></a> <a name="list"></a>
<h3>list</h3> <h3>list</h3>
<ul> <ul>
<code>list [devspec]</code> <code>list [devspec] [value]</code>
<br><br> <br><br>
Output a list of all definitions, all notify settings and all at Output a list of all definitions, all notify settings and all at
entries. This is one of the few commands which return a string in a entries. This is one of the few commands which return a string in a
normal case. normal case.
See the <a href="#devspec">Device specification</a> section for details on See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;. &lt;devspec&gt;.
<br>
If value is specified, then output this property (like DEF, TYPE, etc) or
reading (actuator, measured-temp) for all devices from the devspec.
<br><br> <br><br>
Example: Example:
<pre><code> FHZ> list <pre><code> FHZ> list

View File

@ -155,7 +155,7 @@ my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0; my $intAtCnt=0;
my %duplicate; # Pool of received msg for multi-fhz/cul setups my %duplicate; # Pool of received msg for multi-fhz/cul setups
my $duplidx=0; # helper for the above pool my $duplidx=0; # helper for the above pool
my $cvsid = '$Id: fhem.pl,v 1.86 2009-11-25 10:48:01 rudolfkoenig Exp $'; my $cvsid = '$Id: fhem.pl,v 1.87 2009-11-25 11:13:44 rudolfkoenig Exp $';
my $namedef = my $namedef =
"where <name> is either:\n" . "where <name> is either:\n" .
"- a single device name\n" . "- a single device name\n" .
@ -1214,8 +1214,26 @@ CommandList($$)
} else { } else {
my @list = devspec2array($param); my @arg = split(" ", $param);
if(@list == 1) { my @list = devspec2array($arg[0]);
if($arg[1]) {
foreach my $sdev (@list) {
if($defs{$sdev} &&
$defs{$sdev}{$arg[1]}) {
$str .= $sdev . " " .
$defs{$sdev}{$arg[1]} . "\n";
} elsif($defs{$sdev} &&
$defs{$sdev}{READINGS} &&
$defs{$sdev}{READINGS}{$arg[1]}) {
$str .= $sdev . " ".
$defs{$sdev}{READINGS}{$arg[1]}{TIME} . " " .
$defs{$sdev}{READINGS}{$arg[1]}{VAL} . "\n";
}
}
} elsif(@list == 1) {
my $sdev = $list[0]; my $sdev = $list[0];
if(!defined($defs{$sdev})) { if(!defined($defs{$sdev})) {
$str .= "No device named $param found"; $str .= "No device named $param found";
@ -1225,10 +1243,12 @@ CommandList($$)
$str .= "Attributes:\n"; $str .= "Attributes:\n";
$str .= PrintHash($attr{$sdev}, 2); $str .= PrintHash($attr{$sdev}, 2);
} }
} else { } else {
foreach my $sdev (@list) { foreach my $sdev (@list) {
$str .= "$sdev\n"; $str .= "$sdev\n";
} }
} }
} }