2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

added attributes polls and interfaces to OWDevice

git-svn-id: https://svn.fhem.de/fhem/trunk@2399 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2012-12-31 12:45:40 +00:00
parent 73274915d6
commit a4040bf0b2
2 changed files with 31 additions and 3 deletions

View File

@ -280,8 +280,8 @@ OWServer_Set($@)
<ul>
<code>get &lt;name&gt; devices</code>
<br><br>
Lists the addresses and types of all 1-wire devices provided by the owserver, Also shows
the corresponding <a href="#OWDevice">OWDevice</a> devices if defined.
Lists the addresses and types of all 1-wire devices provided by the owserver. Also shows
the corresponding <a href="#OWDevice">OWDevice</a> if one is defined for the respective 1-wire devices.
<br><br>
</ul>
<br><br>

View File

@ -38,8 +38,9 @@ OWDevice_Initialize($)
$hash->{GetFn} = "OWDevice_Get";
$hash->{SetFn} = "OWDevice_Set";
$hash->{DefFn} = "OWDevice_Define";
$hash->{AttrFn} = "OWDevice_Attr";
$hash->{AttrList} = "trimvalues loglevel:0,1,2,3,4,5";
$hash->{AttrList} = "trimvalues polls interfaces loglevel:0,1,2,3,4,5";
}
###################################
@ -208,6 +209,31 @@ OWDevice_UpdateValues($) {
}
###################################
sub
OWDevice_Attr($@)
{
my ($cmd, $name, $attrName, $attrVal) = @_;
my $hash = $defs{$name};
$attrVal= "" unless defined($attrVal);
$attrVal= "" if($cmd eq "del");
if($attrName eq "polls") {
my @polls= split(",", $attrVal);
$hash->{fhem}{polls}= \@polls;
Log 5, "$name: polls: " . join(" ", @polls);
} elsif($attrName eq "interfaces") {
if($attrVal ne "") {
$hash->{fhem}{interfaces}= join(";",split(",",$attrVal));
Log 5, "$name: interfaces: " . $hash->{fhem}{interfaces};
} else {
delete $hash->{fhem}{interfaces} if(defined($hash->{fhem}{interfaces}));
Log 5, "$name: no interfaces";
}
}
}
###################################
sub
OWDevice_Get($@)
@ -419,6 +445,8 @@ OWDevice_Define($$)
<b>Attributes</b>
<ul>
<li>trimvalues: removes leading and trailing whitespace from readings. Default is 1 (on).</li>
<li>polls: a comma-separated list of readings to poll. This supersedes the list of default readings to poll.</li>
<li>interfaces: supersedes the interfaces exposed by that device.</li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#eventMap">eventMap</a></li>
<li><a href="#event-on-update-reading">event-on-update-reading</a></li>