diff --git a/CHANGED b/CHANGED index e1091bcfc..de0f71805 100644 --- a/CHANGED +++ b/CHANGED @@ -553,3 +553,5 @@ - bugfix: PachLog fixes from Axel - bugfix: HOWTO/Examples revisited for correctness - 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 diff --git a/FHEM/20_OWFS.pm b/FHEM/20_OWFS.pm index d8dd0d8b5..9b470d5c3 100644 --- a/FHEM/20_OWFS.pm +++ b/FHEM/20_OWFS.pm @@ -30,6 +30,7 @@ use OW; my %models = ( "DS1420" => "", + "DS9097" => "", ); my %fc = ( "1:DS9420" => "01", @@ -77,6 +78,8 @@ OWFS_Get($$) my ($hash,@a) = @_; 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) if(!defined($gets{$a[1]})); @@ -116,10 +119,12 @@ OWFS_DoInit($) my $path; 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) { - $ret = OWFS_GetData($hash,$q); + foreach my $q (sort keys %gets) { + $ret = OWFS_GetData($hash,$q); + } } $hash->{STATE} = "Initialized" if (!$hash->{STATE}); @@ -137,7 +142,7 @@ OWFS_Define($$) my @a = split("[ \t][ \t]*", $def); - return "wrong syntax: define OWFS " + return "wrong syntax: define OWFS []" if (@a < 2 && int(@a) > 5); my $name = $a[0]; @@ -149,22 +154,24 @@ OWFS_Define($$) return "Define $name: wrong model: specify one of " . join ",", sort keys %models if (!grep { $_ eq $model } keys %models); - my $id = $a[4]; - return "Define $name: wrong ID format: specify a 12 digit value" - if (uc($id) !~ m/^[0-9|A-F]{12}$/); + if (@a > 4) { + my $id = $a[4]; + return "Define $name: wrong ID format: specify a 12 digit value" + if (uc($id) !~ m/^[0-9|A-F]{12}$/); - $hash->{FamilyCode} = \%fc; - my $fc = $hash->{FamilyCode}; - if (defined ($fc)) { - foreach my $c (sort keys %{$fc}) { - if ($c =~ m/$model/) { - $hash->{OW_FAMILY} = $fc->{$c}; + $hash->{FamilyCode} = \%fc; + my $fc = $hash->{FamilyCode}; + if (defined ($fc)) { + foreach my $c (sort keys %{$fc}) { + if ($c =~ m/$model/) { + $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"; diff --git a/FHEM/21_OWTEMP.pm b/FHEM/21_OWTEMP.pm index e797ca053..8676ba6bf 100644 --- a/FHEM/21_OWTEMP.pm +++ b/FHEM/21_OWTEMP.pm @@ -273,6 +273,8 @@ OWTEMP_Define($$) $defptr{$a[2]} = $hash; AssignIoPort($hash); + return "No I/O device found. Please define a OWFS device first." + if(!defined($hash->{IODev}->{NAME})); $hash->{LOCAL} = 2; OWTEMP_GetUpdate($hash,""); delete $hash->{LOCAL}; diff --git a/docs/commandref.html b/docs/commandref.html index cfc7466a5..019ddc7c8 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -2876,7 +2876,7 @@ A line ending with \ will be concatenated with the next one, so long lines Define
    - define <name> OWFS <owserver-ip:port> <model> <id> + define <name> OWFS <owserver-ip:port> <model> [<id>]

    Define a 1-wire device to communicate with an OWFS-Server.

    @@ -2888,11 +2888,11 @@ A line ending with \ will be concatenated with the next one, so long lines <model>
      Define the type of the input device. - Currently supportet: DS1420 + Currently supportet: DS1420, DS9097 (for passive Adapter)
    <id>
      - Corresponding to the id of the input device. + Corresponding to the id of the input device. Only for active Adapter.

    @@ -2902,7 +2902,13 @@ A line ending with \ will be concatenated with the next one, so long lines Example:
      - define DS9490R OWFS 127.0.0.1:4304 DS1420 93302D000000
      + #define an active Adapter:
      + define DS9490R OWFS 127.0.0.1:4304 DS1420 93302D000000

      +
    +
    +
      + #define a passive Adapter:
      + define DS9097 OWFS 127.0.0.1:4304 DS9097


@@ -2914,7 +2920,7 @@ A line ending with \ will be concatenated with the next one, so long lines
    get <name> <value>

    - where value is one of:
    + where value is one of (not supported by passive Devices e.g. DS9097):
    • address (read-only)
      @@ -3030,7 +3036,7 @@ A line ending with \ will be concatenated with the next one, so long lines Example:
        - define KG.hz.TF.01 OWTEMP 93302D000000 300 60
        + define KG.hz.TF.01 OWTEMP 14B598010800 300 60