From bc1cc52b9cbad157786cb439c78c3d0909388dcc Mon Sep 17 00:00:00 2001 From: pahenning <> Date: Sun, 8 Jul 2012 11:01:04 +0000 Subject: [PATCH] git-svn-id: https://svn.fhem.de/fhem/trunk@1705 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/1-Wire/21_OWAD.pm | 11 ++++++----- fhem/contrib/1-Wire/21_OWCOUNT.pm | 8 +++++++- fhem/contrib/1-Wire/21_OWID.pm | 2 +- fhem/contrib/1-Wire/21_OWLCD.pm | 2 +- fhem/contrib/1-Wire/21_OWSWITCH.pm | 28 ++++++++++------------------ fhem/contrib/1-Wire/21_OWTHERM.pm | 10 +++++----- 6 files changed, 30 insertions(+), 31 deletions(-) diff --git a/fhem/contrib/1-Wire/21_OWAD.pm b/fhem/contrib/1-Wire/21_OWAD.pm index ba37933d0..3c583d52f 100644 --- a/fhem/contrib/1-Wire/21_OWAD.pm +++ b/fhem/contrib/1-Wire/21_OWAD.pm @@ -18,7 +18,7 @@ # # Prof. Dr. Peter A. Henning, 2012 # -# Version 2.03 - July, 2012 +# Version 2.1 - July, 2012 # # Setup bus device in fhem.cfg as # @@ -723,7 +723,7 @@ sub OWAD_Set($@) { $mmax *= $factor if ( $factor ); return sprintf("OWAD: Set with wrong value $value for $key, range is [%3.1f,%3.1f]",$mmin,$mmax) - if($value < $mmin || $value > $mmax); + if($value < $mmin || $value > $mmax); $value /= $factor if ( $factor ); $value -= $offset if ( $offset ); @@ -751,12 +751,13 @@ sub OWAD_Set($@) { return "OWAD: Set with wrong IODev type $interface"; } } - #-- process results - + + #-- process results - we have to reread the device $hash->{PRESENT} = 1; + OWAD_GetValues($hash); OWAD_FormatValues($hash); - Log 4, "OWAD: Set $hash->{NAME} $key $value"; + return undef; } diff --git a/fhem/contrib/1-Wire/21_OWCOUNT.pm b/fhem/contrib/1-Wire/21_OWCOUNT.pm index b4ba58929..e60c13d99 100644 --- a/fhem/contrib/1-Wire/21_OWCOUNT.pm +++ b/fhem/contrib/1-Wire/21_OWCOUNT.pm @@ -18,7 +18,7 @@ # # Prof. Dr. Peter A. Henning, 2012 # -# Version 2.03 - July, 2012 +# Version 2.1 - July, 2012 # # Setup bus device in fhem.cfg as # @@ -672,6 +672,12 @@ sub OWCOUNT_Set($@) { return "OWCOUNT: Set with wrong IODev type $interface"; } } + + #-- process results - we have to reread the device + $hash->{PRESENT} = 1; + OWCOUNT_GetValues($hash); + OWCOUNT_FormatValues($hash); + Log 4, "OWCOUNT: Set $hash->{NAME} $key $value"; } ######################################################################################## diff --git a/fhem/contrib/1-Wire/21_OWID.pm b/fhem/contrib/1-Wire/21_OWID.pm index b0d1704b6..b6e52728d 100644 --- a/fhem/contrib/1-Wire/21_OWID.pm +++ b/fhem/contrib/1-Wire/21_OWID.pm @@ -12,7 +12,7 @@ # # Prof. Dr. Peter A. Henning, 2012 # -# Version 2.03 - July, 2012 +# Version 2.1 - July, 2012 # # Setup bus device in fhem.cfg as # diff --git a/fhem/contrib/1-Wire/21_OWLCD.pm b/fhem/contrib/1-Wire/21_OWLCD.pm index 810aae593..8272c7c21 100644 --- a/fhem/contrib/1-Wire/21_OWLCD.pm +++ b/fhem/contrib/1-Wire/21_OWLCD.pm @@ -12,7 +12,7 @@ # # Prof. Dr. Peter A. Henning, 2012 # -# Version 2.03 - July, 2012 +# Version 2.1 - July, 2012 # # Setup bus device in fhem.cfg as # diff --git a/fhem/contrib/1-Wire/21_OWSWITCH.pm b/fhem/contrib/1-Wire/21_OWSWITCH.pm index 734f777c6..ca13348ca 100644 --- a/fhem/contrib/1-Wire/21_OWSWITCH.pm +++ b/fhem/contrib/1-Wire/21_OWSWITCH.pm @@ -16,7 +16,7 @@ # # Prof. Dr. Peter A. Henning, 2012 # -# Version 2.03 - July, 2012 +# Version 2.1 - July, 2012 # # Setup bus device in fhem.cfg as # @@ -564,13 +564,9 @@ sub OWSWITCH_Set($@) { }else{ return "OWSWITCH: Get with wrong IODev type $interface"; } - #-- process results - OWSWITCH_FormatValues($hash); - return undef; - } #-- set state - if( $key eq "gpio" ){ + }elsif( $key eq "gpio" ){ #-- check value and write to device return "OWSWITCH: Set with wrong value for gpio port, must be 0 <= gpio <= 3" if( ! ((int($value) >= 0) && (int($value) <= 3)) ); @@ -582,19 +578,15 @@ sub OWSWITCH_Set($@) { }else{ return "OWSWITCH: GetValues with wrong IODev type $interface"; } - - #-- process results - if( defined($ret) ){ - return $ret; - } else { - $hash->{PRESENT} = 1; - $value=OWSWITCH_FormatValues($hash); - #--logging - Log 5, $value; - $hash->{CHANGED}[0] = $value; - return $value; - } } + + #-- process results - we have to reread the device + $hash->{PRESENT} = 1; + OWSWITCH_GetValues($hash); + OWSWITCH_FormatValues($hash); + Log 4, "OWSWITCH: Set $hash->{NAME} $key $value"; + $hash->{CHANGED}[0] = $value; + return undef; } ######################################################################################## diff --git a/fhem/contrib/1-Wire/21_OWTHERM.pm b/fhem/contrib/1-Wire/21_OWTHERM.pm index 4ebcf3f22..b03a17090 100755 --- a/fhem/contrib/1-Wire/21_OWTHERM.pm +++ b/fhem/contrib/1-Wire/21_OWTHERM.pm @@ -15,7 +15,7 @@ # Prof. Dr. Peter A. Henning, 2012 # Martin Fischer, 2011 # -# Version 2.03 - July, 2012 +# Version 2.1 - July, 2012 # # Setup bus device in fhem.cfg as # @@ -530,19 +530,19 @@ sub OWTHERM_Set($@) { #-- OWX interface if( $interface eq "OWX" ){ $ret = OWXTHERM_SetValues($hash,@a); - $ret = OWXTHERM_GetValues($hash); #-- OWFS interface }elsif( $interface eq "OWFS" ){ $ret = OWFSTHERM_SetValues($hash,@a); - $ret = OWFSTHERM_GetValues($hash); return $ret if(defined($ret)); } else { return "OWTHERM: Set with wrong IODev type $interface"; } - #-- careful: globals may come from a different device - OWTHERM_FormatValues($hash); + #-- process results - we have to reread the device + $hash->{PRESENT} = 1; + OWTHERM_GetValues($hash); + OWTHERM_FormatValues($hash); Log 4, "OWTHERM: Set $hash->{NAME} $key $value"; return undef;