diff --git a/fhem/FHEM/50_WS300.pm b/fhem/FHEM/50_WS300.pm index 1102c152d..0d0b77254 100644 --- a/fhem/FHEM/50_WS300.pm +++ b/fhem/FHEM/50_WS300.pm @@ -66,7 +66,6 @@ WS300_Initialize($) # Provider $hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model:ws300 ". - "loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; $hash->{DefFn} = "WS300_Define"; @@ -669,7 +668,6 @@ NEXTPOLL: Attributes diff --git a/fhem/FHEM/51_I2C_BMP180.pm b/fhem/FHEM/51_I2C_BMP180.pm index 613f0b945..9d53daad4 100644 --- a/fhem/FHEM/51_I2C_BMP180.pm +++ b/fhem/FHEM/51_I2C_BMP180.pm @@ -72,14 +72,14 @@ sub I2C_BMP180_Initialize($) { my ($hash) = @_; eval "use HiPi::Device::I2C;"; - $libcheck_hasHiPi = 0 if($@); + $libcheck_hasHiPi = 0 if($@); $hash->{DefFn} = 'I2C_BMP180_Define'; $hash->{InitFn} = 'I2C_BMP180_Init'; $hash->{AttrFn} = 'I2C_BMP180_Attr'; $hash->{SetFn} = 'I2C_BMP180_Set'; $hash->{UndefFn} = 'I2C_BMP180_Undef'; - $hash->{I2CRecFn} = 'I2C_BMP180_I2CRec'; + $hash->{I2CRecFn} = 'I2C_BMP180_I2CRec'; $hash->{AttrList} = 'IODev do_not_notify:0,1 showtime:0,1 model:BMP180,BMP085 ' . 'poll_interval:1,2,5,10,20,30 oversampling_settings:0,1,2,3 ' . @@ -119,10 +119,9 @@ sub I2C_BMP180_Define($$) { return $msg; } if ($main::init_done || $hash->{HiPi_used}) { - eval { I2C_BMP180_Init( $hash, [ @a[ 2 .. scalar(@a) - 1 ] ] ); }; - return I2C_BMP180_Catch($@) if $@; - } - + eval { I2C_BMP180_Init( $hash, [ @a[ 2 .. scalar(@a) - 1 ] ] ); }; + return I2C_BMP180_Catch($@) if $@; + } } sub I2C_BMP180_Init($$) { @@ -160,12 +159,12 @@ sub I2C_BMP180_Init($$) { } sub I2C_BMP180_Catch($) { - my $exception = shift; - if ($exception) { - $exception =~ /^(.*)( at.*FHEM.*)$/; - return $1; - } - return undef; + my $exception = shift; + if ($exception) { + $exception =~ /^(.*)( at.*FHEM.*)$/; + return $1; + } + return undef; } =head2 I2C_BMP180_Attr @@ -260,7 +259,7 @@ sub I2C_BMP180_Undef($$) { sub I2C_BMP180_I2CRec ($$) { my ($hash, $clientmsg) = @_; - my $name = $hash->{NAME}; + my $name = $hash->{NAME}; my $pname = undef; unless ($hash->{HiPi_used}) {#nicht nutzen wenn HiPi Bibliothek in Benutzung my $phash = $hash->{IODev}; @@ -275,7 +274,7 @@ sub I2C_BMP180_I2CRec ($$) { || $hash->{HiPi_used}) ) { if ( $clientmsg->{direction} eq "i2cread" && defined($clientmsg->{received}) ) { Log3 $hash, 5, "$name empfangen: $clientmsg->{received}"; - I2C_BMP180_GetCal ($hash, $clientmsg->{received}) if $clientmsg->{reg} == hex("AA"); + I2C_BMP180_GetCal ($hash, $clientmsg->{received}) if $clientmsg->{reg} == hex("AA"); I2C_BMP180_GetTemp ($hash, $clientmsg->{received}) if $clientmsg->{reg} == hex("F6") && $clientmsg->{nbyte} == 2; I2C_BMP180_GetPress ($hash, $clientmsg->{received}) if $clientmsg->{reg} == hex("F6") && $clientmsg->{nbyte} == 3; } @@ -284,7 +283,7 @@ sub I2C_BMP180_I2CRec ($$) { sub I2C_BMP180_GetCal ($$) { my ($hash, $rawdata) = @_; - my @raw = split(" ",$rawdata); + my @raw = split(" ",$rawdata); my $n = 0; Log3 $hash, 5, "in get cal: $rawdata"; $hash->{calibrationData}{ac1} = I2C_BMP180_GetCalVar($raw[$n++], $raw[$n++]); @@ -317,23 +316,23 @@ sub I2C_BMP180_GetCalVar ($$;$) { sub I2C_BMP180_GetTemp ($$) { my ($hash, $rawdata) = @_; - my @raw = split(" ",$rawdata); - $hash->{uncompTemp} = $raw[0] << 8 | $raw[1]; + my @raw = split(" ",$rawdata); + $hash->{uncompTemp} = $raw[0] << 8 | $raw[1]; } sub I2C_BMP180_GetPress ($$) { my ($hash, $rawdata) = @_; - my @raw = split(" ",$rawdata); + my @raw = split(" ",$rawdata); my $overSamplingSettings = AttrVal($hash->{NAME}, 'oversampling_settings', 3); - my $ut = $hash->{uncompTemp}; + my $ut = $hash->{uncompTemp}; delete $hash->{uncompTemp}; my $up = ( ( ($raw[0] << 16) | ($raw[1] << 8) | $raw[2] ) >> (8 - $overSamplingSettings) ); my $temperature = sprintf( - '%.' . AttrVal($hash->{NAME}, 'roundTemperatureDecimal', 1) . 'f', - I2C_BMP180_calcTrueTemperature($hash, $ut) / 10 - ); + '%.' . AttrVal($hash->{NAME}, 'roundTemperatureDecimal', 1) . 'f', + I2C_BMP180_calcTrueTemperature($hash, $ut) / 10 + ); my $pressure = sprintf( '%.' . AttrVal($hash->{NAME}, 'roundPressureDecimal', 1) . 'f', @@ -369,7 +368,7 @@ sub I2C_BMP180_GetPress ($$) { =cut sub I2C_BMP180_readUncompensatedTemperature($) { my ($hash) = @_; - + # Write 0x2E into Register 0xF4. This requests a temperature reading I2C_BMP180_i2cwrite($hash, hex("F4"), hex("2E")); @@ -452,8 +451,8 @@ sub I2C_BMP180_i2cwrite($$$) { CallFn($iodev->{NAME}, "I2CWrtFn", $iodev, { direction => "i2cwrite", i2caddress => $hash->{I2C_Address}, - reg => $reg, - data => join (' ',@data), + reg => $reg, + data => join (' ',@data), }); } else { return "no IODev assigned to '$hash->{NAME}'"; @@ -531,39 +530,39 @@ sub I2C_BMP180_calcTruePressure($$$) { via the i2c bus on Raspberry Pi.

There are two possibilities connecting to I2C bus:
-

+ +

Define