change state after set command

This commit is contained in:
Marko Oldenburg 2020-01-10 12:11:08 +01:00
parent 870f27b0ac
commit f415a90768

View File

@ -474,9 +474,9 @@ sub NUKIDevice_WriteReadings($$) {
############################
#### Status des Smartlock
my $state;
if ( defined( $hash->{helper}{lockAction} ) ) {
my $state;
if (
defined( $decode_json->{success} )
and ( $decode_json->{success} eq 'true'
@ -502,6 +502,7 @@ sub NUKIDevice_WriteReadings($$) {
$hash->{DEVICETYPE} );
}
$decode_json->{'state'} = $state;
delete $hash->{helper}{lockAction};
}
@ -527,7 +528,7 @@ sub NUKIDevice_WriteReadings($$) {
or $t eq 'deviceType'
or $t eq 'paired'
or $t eq 'batteryCritical' );
readingsBulkUpdate( $hash, $t, $lockStates{$v}{ $hash->{DEVICETYPE} } )
readingsBulkUpdate( $hash, $t, ($v =~ m/^[0-9]$/ ? $lockStates{$v}{ $hash->{DEVICETYPE} } : $v) )
if ( $t eq 'state' );
readingsBulkUpdate( $hash, $t, $modes{$v}{ $hash->{DEVICETYPE} } )
if ( $t eq 'mode' );