git-svn-id: https://svn.fhem.de/fhem/trunk@1705 2b470e98-0d58-463d-a4d8-8e2adae1ed80

This commit is contained in:
pahenning
2012-07-08 11:01:04 +00:00
parent 0ba1f71474
commit d252520ecf
6 changed files with 30 additions and 31 deletions

View File

@@ -18,7 +18,7 @@
# #
# Prof. Dr. Peter A. Henning, 2012 # Prof. Dr. Peter A. Henning, 2012
# #
# Version 2.03 - July, 2012 # Version 2.1 - July, 2012
# #
# Setup bus device in fhem.cfg as # Setup bus device in fhem.cfg as
# #
@@ -723,7 +723,7 @@ sub OWAD_Set($@) {
$mmax *= $factor if ( $factor ); $mmax *= $factor if ( $factor );
return sprintf("OWAD: Set with wrong value $value for $key, range is [%3.1f,%3.1f]",$mmin,$mmax) 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 /= $factor if ( $factor );
$value -= $offset if ( $offset ); $value -= $offset if ( $offset );
@@ -751,12 +751,13 @@ sub OWAD_Set($@) {
return "OWAD: Set with wrong IODev type $interface"; return "OWAD: Set with wrong IODev type $interface";
} }
} }
#-- process results
#-- process results - we have to reread the device
$hash->{PRESENT} = 1; $hash->{PRESENT} = 1;
OWAD_GetValues($hash);
OWAD_FormatValues($hash); OWAD_FormatValues($hash);
Log 4, "OWAD: Set $hash->{NAME} $key $value"; Log 4, "OWAD: Set $hash->{NAME} $key $value";
return undef; return undef;
} }

View File

@@ -18,7 +18,7 @@
# #
# Prof. Dr. Peter A. Henning, 2012 # Prof. Dr. Peter A. Henning, 2012
# #
# Version 2.03 - July, 2012 # Version 2.1 - July, 2012
# #
# Setup bus device in fhem.cfg as # Setup bus device in fhem.cfg as
# #
@@ -672,6 +672,12 @@ sub OWCOUNT_Set($@) {
return "OWCOUNT: Set with wrong IODev type $interface"; 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";
} }
######################################################################################## ########################################################################################

View File

@@ -12,7 +12,7 @@
# #
# Prof. Dr. Peter A. Henning, 2012 # Prof. Dr. Peter A. Henning, 2012
# #
# Version 2.03 - July, 2012 # Version 2.1 - July, 2012
# #
# Setup bus device in fhem.cfg as # Setup bus device in fhem.cfg as
# #

View File

@@ -12,7 +12,7 @@
# #
# Prof. Dr. Peter A. Henning, 2012 # Prof. Dr. Peter A. Henning, 2012
# #
# Version 2.03 - July, 2012 # Version 2.1 - July, 2012
# #
# Setup bus device in fhem.cfg as # Setup bus device in fhem.cfg as
# #

View File

@@ -16,7 +16,7 @@
# #
# Prof. Dr. Peter A. Henning, 2012 # Prof. Dr. Peter A. Henning, 2012
# #
# Version 2.03 - July, 2012 # Version 2.1 - July, 2012
# #
# Setup bus device in fhem.cfg as # Setup bus device in fhem.cfg as
# #
@@ -564,13 +564,9 @@ sub OWSWITCH_Set($@) {
}else{ }else{
return "OWSWITCH: Get with wrong IODev type $interface"; return "OWSWITCH: Get with wrong IODev type $interface";
} }
#-- process results
OWSWITCH_FormatValues($hash);
return undef;
}
#-- set state #-- set state
if( $key eq "gpio" ){ }elsif( $key eq "gpio" ){
#-- check value and write to device #-- check value and write to device
return "OWSWITCH: Set with wrong value for gpio port, must be 0 <= gpio <= 3" return "OWSWITCH: Set with wrong value for gpio port, must be 0 <= gpio <= 3"
if( ! ((int($value) >= 0) && (int($value) <= 3)) ); if( ! ((int($value) >= 0) && (int($value) <= 3)) );
@@ -582,19 +578,15 @@ sub OWSWITCH_Set($@) {
}else{ }else{
return "OWSWITCH: GetValues with wrong IODev type $interface"; 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;
} }
######################################################################################## ########################################################################################

View File

@@ -15,7 +15,7 @@
# Prof. Dr. Peter A. Henning, 2012 # Prof. Dr. Peter A. Henning, 2012
# Martin Fischer, 2011 # Martin Fischer, 2011
# #
# Version 2.03 - July, 2012 # Version 2.1 - July, 2012
# #
# Setup bus device in fhem.cfg as # Setup bus device in fhem.cfg as
# #
@@ -530,19 +530,19 @@ sub OWTHERM_Set($@) {
#-- OWX interface #-- OWX interface
if( $interface eq "OWX" ){ if( $interface eq "OWX" ){
$ret = OWXTHERM_SetValues($hash,@a); $ret = OWXTHERM_SetValues($hash,@a);
$ret = OWXTHERM_GetValues($hash);
#-- OWFS interface #-- OWFS interface
}elsif( $interface eq "OWFS" ){ }elsif( $interface eq "OWFS" ){
$ret = OWFSTHERM_SetValues($hash,@a); $ret = OWFSTHERM_SetValues($hash,@a);
$ret = OWFSTHERM_GetValues($hash);
return $ret return $ret
if(defined($ret)); if(defined($ret));
} else { } else {
return "OWTHERM: Set with wrong IODev type $interface"; 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"; Log 4, "OWTHERM: Set $hash->{NAME} $key $value";
return undef; return undef;