mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
OWFS: support for passive devices; bugfixing
git-svn-id: https://svn.fhem.de/fhem/trunk@506 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
88d71000f0
commit
b50468deeb
@ -553,3 +553,5 @@
|
|||||||
- bugfix: PachLog fixes from Axel
|
- bugfix: PachLog fixes from Axel
|
||||||
- bugfix: HOWTO/Examples revisited for correctness
|
- bugfix: HOWTO/Examples revisited for correctness
|
||||||
- bugfix: DEFINED & INITIALIZED triggers.
|
- bugfix: DEFINED & INITIALIZED triggers.
|
||||||
|
- feature: 20_OWFS.pm support for passive Devices e.g. DS9097 (see commandref.html)
|
||||||
|
- bugfix: 21_OWTEMP.pm Defining a device now fail when no OWFS device was defined
|
||||||
|
@ -30,6 +30,7 @@ use OW;
|
|||||||
|
|
||||||
my %models = (
|
my %models = (
|
||||||
"DS1420" => "",
|
"DS1420" => "",
|
||||||
|
"DS9097" => "",
|
||||||
);
|
);
|
||||||
my %fc = (
|
my %fc = (
|
||||||
"1:DS9420" => "01",
|
"1:DS9420" => "01",
|
||||||
@ -77,6 +78,8 @@ OWFS_Get($$)
|
|||||||
my ($hash,@a) = @_;
|
my ($hash,@a) = @_;
|
||||||
|
|
||||||
return "argument is missing @a" if (@a != 2);
|
return "argument is missing @a" if (@a != 2);
|
||||||
|
return "Passive Adapter defined. No Get function implemented."
|
||||||
|
if(!defined($hash->{OW_ID}));
|
||||||
return "Unknown argument $a[1], choose one of " . join(",", sort keys %gets)
|
return "Unknown argument $a[1], choose one of " . join(",", sort keys %gets)
|
||||||
if(!defined($gets{$a[1]}));
|
if(!defined($gets{$a[1]}));
|
||||||
|
|
||||||
@ -116,10 +119,12 @@ OWFS_DoInit($)
|
|||||||
my $path;
|
my $path;
|
||||||
my $ret;
|
my $ret;
|
||||||
|
|
||||||
$path = $hash->{OW_FAMILY}.".".$hash->{OWFS_ID};
|
if (defined($hash->{OWFS_ID})) {
|
||||||
|
$path = $hash->{OW_FAMILY}.".".$hash->{OWFS_ID};
|
||||||
|
|
||||||
foreach my $q (sort keys %gets) {
|
foreach my $q (sort keys %gets) {
|
||||||
$ret = OWFS_GetData($hash,$q);
|
$ret = OWFS_GetData($hash,$q);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash->{STATE} = "Initialized" if (!$hash->{STATE});
|
$hash->{STATE} = "Initialized" if (!$hash->{STATE});
|
||||||
@ -137,7 +142,7 @@ OWFS_Define($$)
|
|||||||
|
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
return "wrong syntax: define <name> OWFS <owserver:port> <model> <id>"
|
return "wrong syntax: define <name> OWFS <owserver:port> <model> [<id>]"
|
||||||
if (@a < 2 && int(@a) > 5);
|
if (@a < 2 && int(@a) > 5);
|
||||||
|
|
||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
@ -149,22 +154,24 @@ OWFS_Define($$)
|
|||||||
return "Define $name: wrong model: specify one of " . join ",", sort keys %models
|
return "Define $name: wrong model: specify one of " . join ",", sort keys %models
|
||||||
if (!grep { $_ eq $model } keys %models);
|
if (!grep { $_ eq $model } keys %models);
|
||||||
|
|
||||||
my $id = $a[4];
|
if (@a > 4) {
|
||||||
return "Define $name: wrong ID format: specify a 12 digit value"
|
my $id = $a[4];
|
||||||
if (uc($id) !~ m/^[0-9|A-F]{12}$/);
|
return "Define $name: wrong ID format: specify a 12 digit value"
|
||||||
|
if (uc($id) !~ m/^[0-9|A-F]{12}$/);
|
||||||
|
|
||||||
$hash->{FamilyCode} = \%fc;
|
$hash->{FamilyCode} = \%fc;
|
||||||
my $fc = $hash->{FamilyCode};
|
my $fc = $hash->{FamilyCode};
|
||||||
if (defined ($fc)) {
|
if (defined ($fc)) {
|
||||||
foreach my $c (sort keys %{$fc}) {
|
foreach my $c (sort keys %{$fc}) {
|
||||||
if ($c =~ m/$model/) {
|
if ($c =~ m/$model/) {
|
||||||
$hash->{OW_FAMILY} = $fc->{$c};
|
$hash->{OW_FAMILY} = $fc->{$c};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete ($hash->{FamilyCode});
|
||||||
|
$hash->{OW_ID} = $id;
|
||||||
|
$hash->{OW_PATH} = $hash->{OW_FAMILY}.".".$hash->{OW_ID};
|
||||||
}
|
}
|
||||||
delete ($hash->{FamilyCode});
|
|
||||||
$hash->{OW_ID} = $id;
|
|
||||||
$hash->{OW_PATH} = $hash->{OW_FAMILY}.".".$hash->{OW_ID};
|
|
||||||
|
|
||||||
$hash->{STATE} = "Defined";
|
$hash->{STATE} = "Defined";
|
||||||
|
|
||||||
|
@ -273,6 +273,8 @@ OWTEMP_Define($$)
|
|||||||
$defptr{$a[2]} = $hash;
|
$defptr{$a[2]} = $hash;
|
||||||
AssignIoPort($hash);
|
AssignIoPort($hash);
|
||||||
|
|
||||||
|
return "No I/O device found. Please define a OWFS device first."
|
||||||
|
if(!defined($hash->{IODev}->{NAME}));
|
||||||
$hash->{LOCAL} = 2;
|
$hash->{LOCAL} = 2;
|
||||||
OWTEMP_GetUpdate($hash,"");
|
OWTEMP_GetUpdate($hash,"");
|
||||||
delete $hash->{LOCAL};
|
delete $hash->{LOCAL};
|
||||||
|
@ -2876,7 +2876,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<a name="OWFSdefine"></a>
|
<a name="OWFSdefine"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> OWFS <owserver-ip:port> <model> <id></code>
|
<code>define <name> OWFS <owserver-ip:port> <model> [<id>]</code>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
Define a 1-wire device to communicate with an OWFS-Server.<br><br>
|
Define a 1-wire device to communicate with an OWFS-Server.<br><br>
|
||||||
@ -2888,11 +2888,11 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<code><model></code>
|
<code><model></code>
|
||||||
<ul>
|
<ul>
|
||||||
Define the <a href="#owfs_type">type</a> of the input device.
|
Define the <a href="#owfs_type">type</a> of the input device.
|
||||||
Currently supportet: <code>DS1420</code>
|
Currently supportet: <code>DS1420, DS9097 (for passive Adapter)</code>
|
||||||
</ul>
|
</ul>
|
||||||
<code><id></code>
|
<code><id></code>
|
||||||
<ul>
|
<ul>
|
||||||
Corresponding to the <a href="#owfs_id">id</a> of the input device.
|
Corresponding to the <a href="#owfs_id">id</a> of the input device. Only for active Adapter.
|
||||||
<br><br>
|
<br><br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -2902,7 +2902,13 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
<ul>
|
<ul>
|
||||||
<code>define DS9490R OWFS 127.0.0.1:4304 DS1420 93302D000000</code><br>
|
<code>#define an active Adapter:<br>
|
||||||
|
define DS9490R OWFS 127.0.0.1:4304 DS1420 93302D000000</code><br>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
<ul>
|
||||||
|
<code>#define a passive Adapter:<br>
|
||||||
|
define DS9097 OWFS 127.0.0.1:4304 DS9097</code><br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
@ -2914,7 +2920,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<ul>
|
<ul>
|
||||||
<code>get <name> <value></code>
|
<code>get <name> <value></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
where <code>value</code> is one of:<br>
|
where <code>value</code> is one of (not supported by passive Devices e.g. DS9097):<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a name="owfs_address"></a>
|
<li><a name="owfs_address"></a>
|
||||||
<code>address</code> (read-only)<br>
|
<code>address</code> (read-only)<br>
|
||||||
@ -3030,7 +3036,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
<ul>
|
<ul>
|
||||||
<code>define KG.hz.TF.01 OWTEMP 93302D000000 300 60</code><br>
|
<code>define KG.hz.TF.01 OWTEMP 14B598010800 300 60</code><br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user