2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-04 17:08:43 +00:00

fhem.pl: Add userattr for signle devices.

git-svn-id: https://svn.fhem.de/fhem/trunk@6632 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-09-29 19:52:15 +00:00
parent bd58157c4e
commit 31dc910625
4 changed files with 21 additions and 7 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: userattr is now also device attribute
- feature: ZWave: Fibaro_FGRM222 MANUFACTURER_PROPRIETARY class
- feature: sequence: reportEvents attribtue added
- feature: SYSMON: RAM and SWAP Readings on OSX

View File

@ -1255,8 +1255,10 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="userattr"></a>
<li>userattr<br>
A space separated list which contains the names of additional
attributes. Without specifying them you will not be able to set them
(in order to prevent typos).
attributes for all devices. Without specifying them you will not be
able to set them (in order to prevent typos).<br>
userattr can also specified for other devices, in this case
these additinal attribute names are only valid for this device.
</li><br>
<a name="dupTimeout"></a>

View File

@ -1346,9 +1346,12 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
<a name="userattr"></a>
<li>userattr<br>
Enth&auml;lt eine durch Leerzeichen getrennte Liste in welcher die Namen
zus&auml;tzlicher Attribute aufgef&uuml;hrt sind. Diese m&uuml;ssen zuerst in dieser Liste
definiert werden, bevor sie angewendet werden k&ouml;nnen.
Enth&auml;lt eine durch Leerzeichen getrennte Liste in welcher die
Namen zus&auml;tzlicher Attribute aufgef&uuml;hrt sind. Diese
m&uuml;ssen zuerst in dieser Liste definiert werden, bevor sie
(bei allen Ger&auml;ten) angewendet werden k&ouml;nnen.<br>
userattr kann auch f&uuml;r einzelne Ger&auml;te spezifiziert werden,
um weitere Attribute f&uuml;r diese Ger&auml;te zu definieren.
</li><br>
<a name="dupTimeout"></a>

View File

@ -240,7 +240,7 @@ $modules{Global}{ORDER} = -1;
$modules{Global}{LOADED} = 1;
$modules{Global}{AttrList} =
"archivecmd apiversion archivedir configfile lastinclude logfile " .
"modpath nrarchive pidfilename port statefile title userattr " .
"modpath nrarchive pidfilename port statefile title " .
"mseclog:1,0 version nofork:1,0 logdir holiday2we " .
"autoload_undefined_devices:1,0 dupTimeout latitude longitude altitude " .
"backupcmd backupdir backupsymlink backup_before_update " .
@ -1361,7 +1361,12 @@ CommandSave($$)
print $fh "define $d $defs{$d}{TYPE}\n";
}
}
foreach my $a (sort keys %{$attr{$d}}) {
foreach my $a (sort {
return -1 if($a eq "userattr"); # userattr must be first
return 1 if($b eq "userattr");
return $a cmp $b;
} keys %{$attr{$d}}) {
next if($d eq "global" &&
($a eq "configfile" || $a eq "version"));
my $val = $attr{$d}{$a};
@ -2062,6 +2067,9 @@ getAllAttr($)
if($modules{$defs{$d}{TYPE}}{AttrList});
$list .= " " . $attr{global}{userattr}
if($attr{global}{userattr});
$list .= " " . $attr{$d}{userattr}
if($attr{$d} && $attr{$d}{userattr});
$list .= " userattr";
return $list;
}