mehr Readings nach set lockAction hinzugefügt

This commit is contained in:
Marko Oldenburg 2016-09-28 22:16:46 +02:00
parent 0928638b33
commit 41c01cc6b1

View File

@ -33,7 +33,7 @@ use warnings;
use JSON;
use Time::HiRes qw(gettimeofday);
my $version = "0.1.42";
my $version = "0.1.45";
@ -332,6 +332,14 @@ sub NUKIDevice_Parse($$) {
readingsBeginUpdate($hash);
my $battery;
if( $decode_json->{batteryCritical} eq "false" ) {
$battery = "ok";
} else {
$battery = "low";
}
if( defined($hash->{helper}{lockAction}) ) {
my ($state,$lockState);
@ -344,18 +352,13 @@ sub NUKIDevice_Parse($$) {
readingsBulkUpdate( $hash, "state", $state );
readingsBulkUpdate( $hash, "lockState", $lockState );
readingsBulkUpdate( $hash, "success", $decode_json->{success} );
readingsBulkUpdate( $hash, "batteryCritical", $decode_json->{batteryCritical} );
readingsBulkUpdate( $hash, "battery", $battery );
delete $hash->{helper}{lockAction};
} else {
my $battery;
if( $decode_json->{batteryCritical} eq "false" ) {
$battery = "ok";
} else {
$battery = "low";
}
readingsBulkUpdate( $hash, "batteryCritical", $decode_json->{batteryCritical} );
readingsBulkUpdate( $hash, "lockState", $decode_json->{stateName} );
readingsBulkUpdate( $hash, "state", $decode_json->{stateName} );