From ae5a2570b1c635a3ee126dd11435e407b9b628c7 Mon Sep 17 00:00:00 2001 From: borisneubert Date: Fri, 16 Jun 2017 05:15:56 +0000 Subject: [PATCH] 10_OWDevice: added rudimentary support for 1F device family git-svn-id: https://svn.fhem.de/fhem/trunk@14523 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_OWServer.pm | 1 + fhem/FHEM/11_OWDevice.pm | 33 ++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/10_OWServer.pm b/fhem/FHEM/10_OWServer.pm index a928fa29a..befee6ee2 100644 --- a/fhem/FHEM/10_OWServer.pm +++ b/fhem/FHEM/10_OWServer.pm @@ -43,6 +43,7 @@ use vars qw(%owfamily); "12" => "DS2406 DS2507", "1B" => "DS2436", "1D" => "DS2423", + "1F" => "DS2409", "20" => "DS2450", "22" => "DS1822", "23" => "DS2433", diff --git a/fhem/FHEM/11_OWDevice.pm b/fhem/FHEM/11_OWDevice.pm index 3f6f3780c..494bde0d0 100644 --- a/fhem/FHEM/11_OWDevice.pm +++ b/fhem/FHEM/11_OWDevice.pm @@ -121,6 +121,14 @@ $owdevice{"1D"} = { "offset" => [ qw(counters.A counters.B) ], "interface" => "counter", }; +$owdevice{"1F"} = { + # DS2409 - Microlan Coupler + "read" => [], + "write" => [], + "poll" => [], + "state" => [], + "interface" => "none", +}; $owdevice{"20"} = { # DS2450 - Quad A/D Converter "read" => [ qw(alarm/high.A alarm/high.B alarm/high.C alarm/high.D alarm/high.ALL), @@ -222,9 +230,10 @@ $owdevice{"26"} = { qw(HIH4000/humidity), qw(HTM1735/humidity), qw(DATANAB/humidity), + qw(HIH3600/humidity), qw(humidity), qw(B1-R1-A/pressure B1-R1-A/gain B1-R1-A/offset), - qw(S3-R1-A/current S3-R1-A/illumination S3-R1-A/gain), + qw(S3-R1-A/current S3-R1-A/illumination S3-R1-A/illuminance S3-R1-A/gain), qw(MultiSensor/type), qw(offset) ], "write" => [ qw(pages/page.0 pages/page.1 pages/page.2 pages/page.3 pages/page.4), @@ -392,7 +401,10 @@ OWDevice_GetDetails($) { my ($hash)= @_; - my $family= substr($hash->{fhem}{address}, 0, 2); + my @path= split('/', $hash->{fhem}{address}); + my $address= $path[-1]; + #main::Debug "address is $address"; + my $family= substr($address, 0, 2); my @getters= @{$owdevice{$family}{"read"}}; my @setters= @{$owdevice{$family}{"write"}}; my @polls= @{$owdevice{$family}{"poll"}}; @@ -459,6 +471,7 @@ OWDevice_ReadValue($$) { my $path = "$cache/$address/$reading"; $path .= AttrVal($hash->{NAME},"resolution","") if( $reading eq "temperature" ); #my ($seconds, $microseconds) = gettimeofday(); + #main::Debug "OWDevice_ReadValue NAME=" . $hash->{NAME} . " path=$path"; my $value= OWDevice_ReadFromServer($hash,"read",$path); #my ($seconds2, $microseconds2) = gettimeofday(); #my $msec = sprintf( "%03d msec", (($seconds2-$seconds)*1000000 + $microseconds2-$microseconds)/1000 ); @@ -476,13 +489,14 @@ OWDevice_ReadValue($$) { } ################################### -sub -OWDevice_WriteValue($$$) { +sub OWDevice_WriteValue($$$) { my ($hash,$reading,$value)= @_; + my $cache= (AttrVal($hash->{NAME},"uncached","")) ? "/uncached" : ""; my $address= $hash->{fhem}{address}; - IOWrite($hash, "/$address/$reading", $value); + my $path = "$cache/$address/$reading"; + IOWrite($hash, $path, $value); return $value; } @@ -762,6 +776,10 @@ OWDevice_InitValues($) Defines a 1-wire device. The 1-wire device is identified by its <address>. It is served by the most recently defined OWServer.

+ Devices beyond 1-wire hubs (DS2409, address family 1F) need to be addressed by the full path, e.g. + 1F.0AC004000000/main/26.A157B6000000 (no leading slash). They are + not automatically detected. +

If <interval> is given, the OWServer is polled every <interval> seconds for a subset of readings. @@ -793,6 +811,7 @@ OWDevice_InitValues($)
  • DS2408 - 1-Wire 8 Channel Addressable Switch
  • DS2413 - Dual Channel Addressable Switch
  • DS1825 - Programmable Resolution 1-Wire Digital Thermometer with ID
  • +
  • DS2409 - Microlan Coupler (no function implemented)
  • EDS0066 - Multisensor for temperature and pressure
  • LCD - LCD controller by Louis Swart
  • @@ -921,6 +940,10 @@ OWDevice_InitValues($) Definiert ein 1-Wire- Gerät. 1-Wire- Geräte werden anhand ihrer Adresse <address> definiert. Diese wird durch den zuvor eingerichteten OWServer bereitgestellt.

    + Geräte hinter 1-wire-Hubs (DS2409, Adressfamilie 1F) müssen über den vollen Pfad adressiert werden, z.B. + 1F.0AC004000000/main/26.A157B6000000 (kein führender Schrägstrich). Sie werden nicht + automatisch erkannt. +

    Wird zusätzlich <interval> angegeben, ruft OWServer alle <interval> Sekunden einen Datensatz des Gerätes ab.