change code

This commit is contained in:
Marko Oldenburg 2019-10-11 12:25:37 +02:00
parent 212741903c
commit c86303cc32

View File

@ -453,9 +453,7 @@ sub stateRequest($) {
elsif ( $hash->{helper}{CallSensDataCounter} < 1 elsif ( $hash->{helper}{CallSensDataCounter} < 1
and AttrVal( $name, 'model', '' ) eq 'clearGrassSens' ) and AttrVal( $name, 'model', '' ) eq 'clearGrassSens' )
{ {
CreateParamGatttool( CreateParamGatttool( $hash, 'read',
$hash,
'read',
$XiaomiModels{ AttrVal( $name, 'model', '' ) }{rdata}, $XiaomiModels{ AttrVal( $name, 'model', '' ) }{rdata},
); );
$hash->{helper}{CallSensDataCounter} = $hash->{helper}{CallSensDataCounter} =
@ -1112,8 +1110,10 @@ sub ClearGrassSensHandle0x1e($$) {
$notification =~ s/\s+//g; $notification =~ s/\s+//g;
$readings{'temperature'} = hex(substr( $notification, 4, 2 ) )/10; $readings{'temperature'} = hex( substr( $notification, 4, 2 ) ) / 10;
$readings{'humidity'} = hex(substr($notification,11,1) .substr($notification,8,2))/10; $readings{'humidity'} =
hex( substr( $notification, 11, 1 ) . substr( $notification, 8, 2 ) ) /
10;
$hash->{helper}{CallBattery} = 0; $hash->{helper}{CallBattery} = 0;
return \%readings; return \%readings;
@ -1176,7 +1176,9 @@ sub WriteReadings($$) {
. ReadingsVal( $name, 'temperature', 0 ) . ' H: ' . ReadingsVal( $name, 'temperature', 0 ) . ' H: '
. ReadingsVal( $name, 'humidity', 0 ) . ReadingsVal( $name, 'humidity', 0 )
) )
) if ( AttrVal( $name, 'model', 'none' ) eq 'thermoHygroSens' ); )
if ( AttrVal( $name, 'model', 'none' ) eq 'thermoHygroSens'
or AttrVal( $name, 'model', 'none' ) eq 'clearGrassSens' );
readingsEndUpdate( $hash, 1 ); readingsEndUpdate( $hash, 1 );