mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
fhem.pl: fix list bug and doc (Forum #104279)
git-svn-id: https://svn.fhem.de/fhem/trunk@20318 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c66ac5a10d
commit
f613e6ed79
@ -941,7 +941,7 @@ The following local attributes are used by a wider range of devices:
|
||||
<a name="list"></a>
|
||||
<h3>list</h3>
|
||||
<ul>
|
||||
<code>list [devspec] [value]</code><br>
|
||||
<code>list [devspec] [value ...]</code><br>
|
||||
or<br>
|
||||
<code>list {-r|-R} devspec</code><br>
|
||||
<br><br>
|
||||
@ -951,13 +951,15 @@ The following local attributes are used by a wider range of devices:
|
||||
See the <a href="#devspec">Device specification</a> section for details on
|
||||
<devspec>.
|
||||
<br>
|
||||
If value is specified, then output this property (like DEF, TYPE, etc) or
|
||||
reading (actuator, measured-temp) for all devices from the devspec.
|
||||
If <value> is specified, then output this property (internal, reading
|
||||
or attribute) for all devices from the devspec. <value> can be
|
||||
restricted with prefix i: for internals, r: for readings and a: for
|
||||
attributes.
|
||||
<br><br>
|
||||
Example:
|
||||
<pre><code> fhem> list
|
||||
<pre><code> fhem> list
|
||||
|
||||
Type list <name> for detailed info.
|
||||
Type list <name> for detailed info.
|
||||
|
||||
Internal:
|
||||
global (Internal)
|
||||
@ -988,7 +990,7 @@ The following local attributes are used by a wider range of devices:
|
||||
</code></pre>
|
||||
If specifying <code>name</code>, then a detailed status for <code>name</code>
|
||||
will be displayed, e.g.:
|
||||
<pre><code> fhem> list fl
|
||||
<pre><code> fhem> list fl
|
||||
|
||||
Internals:
|
||||
CODE 5102
|
||||
|
@ -996,7 +996,7 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
<a name="list"></a>
|
||||
<h3>list</h3>
|
||||
<ul>
|
||||
<code>list [devspec] [value]</code><br>
|
||||
<code>list [devspec] [value ...]</code><br>
|
||||
oder<br>
|
||||
<code>list {-r|-R} devspec</code><br>
|
||||
<br><br>
|
||||
@ -1004,11 +1004,14 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
"at"-Definitionen. Dies ist eines der wenigen Befehle, die im
|
||||
Normalfall eine Zeichenkette ausgeben.<br> Siehe den Abschnitt über <a
|
||||
href="#devspec">Geräte-Spezifikation</a> für Details der
|
||||
<devspec>.<br>
|
||||
<devspec>.<br><br>
|
||||
|
||||
<br> Wenn value angegeben ist, der von ( DEF, TYPE, usw) oder reading
|
||||
(actuator, measured-temp) für alle Geräte die in devspec angegeben
|
||||
sind. <br><br> Beispiel:
|
||||
Wenn <value> angegeben ist, dann wird dieses Wert (Internal, Reading
|
||||
oder Attribut) ausgegeben, soweit es vorhanden ist. Die Werte können mit
|
||||
einem Präfix eingeschränkt werden: i: für Internals, r:
|
||||
für Readings und a: für Attribute.
|
||||
|
||||
<br><br> Beispiel:
|
||||
<pre><code>fhem> list
|
||||
|
||||
Type list <name> for detailed info.
|
||||
|
50
fhem/fhem.pl
50
fhem/fhem.pl
@ -2508,6 +2508,7 @@ CommandList($$)
|
||||
my @list = devspec2array($arg[0],$cl);
|
||||
if($arg[1]) {
|
||||
foreach my $sdev (@list) { # Show a Hash-Entry or Reading for each device
|
||||
next if(!$defs{$sdev});
|
||||
|
||||
my $first = 1;
|
||||
foreach my $n (@arg[1..@arg-1]) {
|
||||
@ -2518,34 +2519,31 @@ CommandList($$)
|
||||
$n = $2;
|
||||
}
|
||||
|
||||
if($defs{$sdev}) {
|
||||
if(defined($defs{$sdev}{$n}) && (!$fType || $fType eq "i:")) {
|
||||
my $val = $defs{$sdev}{$n};
|
||||
if(ref($val) eq 'HASH') {
|
||||
$val = ($val->{NAME} ? $val->{NAME} : # ???
|
||||
join(" ", map { "$_=$val->{$_}" } sort keys %{$val}));
|
||||
}
|
||||
$str .= sprintf("%-20s %*s %*s %s\n", $first?$sdev:'',
|
||||
$arg[2]?19:0, '', $arg[2]?-15:0, $arg[2]?$n:'', $val);
|
||||
|
||||
} elsif($defs{$sdev}{READINGS} &&
|
||||
defined($defs{$sdev}{READINGS}{$n})
|
||||
&& (!$fType || $fType eq "r:")) {
|
||||
$str .= sprintf("%-20s %s %*s %s\n", $first?$sdev:'',
|
||||
$defs{$sdev}{READINGS}{$n}{TIME},
|
||||
$arg[2]?-15:0, $arg[2]?$n:'',
|
||||
$defs{$sdev}{READINGS}{$n}{VAL});
|
||||
|
||||
} elsif($attr{$sdev} &&
|
||||
defined($attr{$sdev}{$n})
|
||||
&& (!$fType || $fType eq "a:")) {
|
||||
$str .= sprintf("%-20s %*s %*s %s\n", $first?$sdev:'',
|
||||
$arg[2]?19:0, '', $arg[2]?-15:0, $arg[2]?$n:'',
|
||||
$attr{$sdev}{$n});
|
||||
|
||||
if(defined($defs{$sdev}{$n}) && (!$fType || $fType eq "i:")) {
|
||||
my $val = $defs{$sdev}{$n};
|
||||
if(ref($val) eq 'HASH') {
|
||||
$val = ($val->{NAME} ? $val->{NAME} : # ???
|
||||
join(" ", map { "$_=$val->{$_}" } sort keys %{$val}));
|
||||
}
|
||||
$str .= sprintf("%-20s %*s %*s %s\n", ($first++==1)?$sdev:'',
|
||||
$arg[2]?19:0, '', $arg[2]?-15:0, $arg[2]?$n:'', $val);
|
||||
|
||||
} elsif($defs{$sdev}{READINGS} &&
|
||||
defined($defs{$sdev}{READINGS}{$n})
|
||||
&& (!$fType || $fType eq "r:")) {
|
||||
$str .= sprintf("%-20s %s %*s %s\n", ($first++==1)?$sdev:'',
|
||||
$defs{$sdev}{READINGS}{$n}{TIME},
|
||||
$arg[2]?-15:0, $arg[2]?$n:'',
|
||||
$defs{$sdev}{READINGS}{$n}{VAL});
|
||||
|
||||
} elsif($attr{$sdev} &&
|
||||
defined($attr{$sdev}{$n})
|
||||
&& (!$fType || $fType eq "a:")) {
|
||||
$str .= sprintf("%-20s %*s %*s %s\n",($first++==1)?$sdev:'',
|
||||
$arg[2]?19:0, '', $arg[2]?-15:0, $arg[2]?$n:'',
|
||||
$attr{$sdev}{$n});
|
||||
|
||||
}
|
||||
$first = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user