mehr Readings nach set lockAction hinzugefügt
This commit is contained in:
		@@ -33,7 +33,7 @@ use warnings;
 | 
				
			|||||||
use JSON;
 | 
					use JSON;
 | 
				
			||||||
use Time::HiRes qw(gettimeofday);
 | 
					use Time::HiRes qw(gettimeofday);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $version = "0.1.42";
 | 
					my $version = "0.1.45";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -332,6 +332,14 @@ sub NUKIDevice_Parse($$) {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    readingsBeginUpdate($hash);
 | 
					    readingsBeginUpdate($hash);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    my $battery;
 | 
				
			||||||
 | 
					    if( $decode_json->{batteryCritical} eq "false" ) {
 | 
				
			||||||
 | 
					        $battery = "ok";
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        $battery = "low";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if( defined($hash->{helper}{lockAction}) ) {
 | 
					    if( defined($hash->{helper}{lockAction}) ) {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        my ($state,$lockState);
 | 
					        my ($state,$lockState);
 | 
				
			||||||
@@ -344,18 +352,13 @@ sub NUKIDevice_Parse($$) {
 | 
				
			|||||||
        readingsBulkUpdate( $hash, "state", $state );
 | 
					        readingsBulkUpdate( $hash, "state", $state );
 | 
				
			||||||
        readingsBulkUpdate( $hash, "lockState", $lockState );
 | 
					        readingsBulkUpdate( $hash, "lockState", $lockState );
 | 
				
			||||||
        readingsBulkUpdate( $hash, "success", $decode_json->{success} );
 | 
					        readingsBulkUpdate( $hash, "success", $decode_json->{success} );
 | 
				
			||||||
 | 
					        readingsBulkUpdate( $hash, "batteryCritical", $decode_json->{batteryCritical} );
 | 
				
			||||||
 | 
					        readingsBulkUpdate( $hash, "battery", $battery );
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        delete $hash->{helper}{lockAction};
 | 
					        delete $hash->{helper}{lockAction};
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        my $battery;
 | 
					 | 
				
			||||||
        if( $decode_json->{batteryCritical} eq "false" ) {
 | 
					 | 
				
			||||||
            $battery = "ok";
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            $battery = "low";
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        readingsBulkUpdate( $hash, "batteryCritical", $decode_json->{batteryCritical} );
 | 
					        readingsBulkUpdate( $hash, "batteryCritical", $decode_json->{batteryCritical} );
 | 
				
			||||||
        readingsBulkUpdate( $hash, "lockState", $decode_json->{stateName} );
 | 
					        readingsBulkUpdate( $hash, "lockState", $decode_json->{stateName} );
 | 
				
			||||||
        readingsBulkUpdate( $hash, "state", $decode_json->{stateName} );
 | 
					        readingsBulkUpdate( $hash, "state", $decode_json->{stateName} );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user