change code
This commit is contained in:
		@@ -437,8 +437,8 @@ sub stateRequest($) {
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
              );
 | 
					              );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (  $hash->{helper}{CallSensDataCounter} < 1 
 | 
					            if ( $hash->{helper}{CallSensDataCounter} < 1
 | 
				
			||||||
              and AttrVal( $name, 'model', '' ) ne 'clearGrassSens' )
 | 
					                and AttrVal( $name, 'model', '' ) ne 'clearGrassSens' )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                CreateParamGatttool(
 | 
					                CreateParamGatttool(
 | 
				
			||||||
                    $hash,
 | 
					                    $hash,
 | 
				
			||||||
@@ -451,11 +451,9 @@ 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 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user