diff --git a/fhem/CHANGED b/fhem/CHANGED index a8100a679..b5ceb9f56 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,8 @@ # 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. - SVN + - feature: new attribute resolution for 1-wire temperature readings + (justme1968 & Boris) - feature: new layout commands moveto, moveby and relative positioning in 02_RSS.pm (Betateilchen & Boris) - feature: FHEMWEB column attribute diff --git a/fhem/FHEM/11_OWDevice.pm b/fhem/FHEM/11_OWDevice.pm index 701c1a559..a5cf303e5 100644 --- a/fhem/FHEM/11_OWDevice.pm +++ b/fhem/FHEM/11_OWDevice.pm @@ -353,6 +353,7 @@ OWDevice_Initialize($) $hash->{AttrFn} = "OWDevice_Attr"; $hash->{AttrList} = "IODev uncached trimvalues polls interfaces model ". + "resolution:9,10,11,12 ". $readingFnAttributes; } @@ -425,8 +426,13 @@ OWDevice_ReadValue($$) { my $address= $hash->{fhem}{address}; my $interface= $hash->{fhem}{interfaces}; my $cache= (AttrVal($hash->{NAME},"uncached","")) ? "/uncached" : ""; - my $value= OWDevice_ReadFromServer($hash,"read","$cache/$address/$reading"); - #Debug "/$address/$reading => $value"; + my $path = "$cache/$address/$reading"; + $path .= AttrVal($hash->{NAME},"resolution","") if( $reading eq "temperature" ); + my ($seconds, $microseconds) = gettimeofday(); + my $value= OWDevice_ReadFromServer($hash,"read",$path); + my ($seconds2, $microseconds2) = gettimeofday(); + #my $msec = sprintf( "%03d msec", (($seconds2-$seconds)*1000000 + $microseconds2-$microseconds)/1000 ); + #Debug "$path => $value; $msec"; if($interface ne "id") { if(defined($value)) { $value= trim($value) if(AttrVal($hash,"trimvalues",1)); @@ -810,6 +816,9 @@ OWDevice_Define($$)
  • polls: a comma-separated list of readings to poll. This supersedes the list of default readings to poll.
  • interfaces: supersedes the interfaces exposed by that device.
  • model: preset with device type, e.g. DS18S20.
  • +
  • resolution: resolution of temperature reading in bits, can be 9, 10, 11 or 12. + Lower resolutions allow for faster retrieval of values from the bus. + Particularly reasonable for large 1-wire installations to reduce busy times for FHEM.
  • eventMap
  • readingFnAttributes