change code style

This commit is contained in:
Marko Oldenburg 2019-07-02 11:47:13 +02:00
parent 21fce76dc3
commit e5724f4605

View File

@ -498,10 +498,12 @@ sub Set($$@) {
} }
else { else {
my $list = ""; my $list = "";
$list .= "resetBatteryTimestamp:noArg" unless ( AttrVal( $name, 'model', 'none' ) eq 'none' ); $list .= "resetBatteryTimestamp:noArg"
unless ( AttrVal( $name, 'model', 'none' ) eq 'none' );
$list .= " devicename" $list .= " devicename"
if ( if (
AttrVal( $name, 'model', 'thermoHygroSens' ) eq 'thermoHygroSens' and AttrVal( $name, 'model', 'none' ) ne 'none' ); AttrVal( $name, 'model', 'thermoHygroSens' ) eq 'thermoHygroSens'
and AttrVal( $name, 'model', 'none' ) ne 'none' );
return "Unknown argument $cmd, choose one of $list"; return "Unknown argument $cmd, choose one of $list";
} }
@ -541,10 +543,12 @@ sub Get($$@) {
} }
else { else {
my $list = ""; my $list = "";
$list .= "sensorData:noArg firmware:noArg" unless ( AttrVal( $name, 'model', 'none' ) eq 'none' ); $list .= "sensorData:noArg firmware:noArg"
unless ( AttrVal( $name, 'model', 'none' ) eq 'none' );
$list .= " devicename:noArg" $list .= " devicename:noArg"
if ( if (
AttrVal( $name, 'model', 'thermoHygroSens' ) eq 'thermoHygroSens' and AttrVal( $name, 'model', 'none' ) ne 'none' ); AttrVal( $name, 'model', 'thermoHygroSens' ) eq 'thermoHygroSens'
and AttrVal( $name, 'model', 'none' ) ne 'none' );
return "Unknown argument $cmd, choose one of $list"; return "Unknown argument $cmd, choose one of $list";
} }
@ -962,7 +966,20 @@ sub ThermoHygroSensHandle0x10($$) {
$notification =~ s/\s+//g; $notification =~ s/\s+//g;
$readings{'temperature'} = pack( 'H*', substr( $notification, 4, 8 ) ); $readings{'temperature'} = pack( 'H*', substr( $notification, 4, 8 ) );
$readings{'humidity'} = pack( 'H*', substr( $notification, ( (scalar(@numberOfHex) == 14 or (scalar(@numberOfHex) == 13 and $readings{'temperature'} > 9)) ? 18 : 16 ), 8 ) ); $readings{'humidity'} = pack(
'H*',
substr(
$notification,
(
(
scalar(@numberOfHex) == 14
or ( scalar(@numberOfHex) == 13
and $readings{'temperature'} > 9 )
) ? 18 : 16
),
8
)
);
$hash->{helper}{CallBattery} = 0; $hash->{helper}{CallBattery} = 0;
return \%readings; return \%readings;