fix multiple calls fn _CheckIsDisabledAfterSetAttr by events from other

devices
This commit is contained in:
Marko Oldenburg 2020-11-03 13:46:24 +01:00
parent ec4e32d2fb
commit cbca8d4337
2 changed files with 18 additions and 3 deletions

View File

@ -1,2 +1,2 @@
UPD 2020-11-03_13:19:18 6242 FHEM/98_backupToStorage.pm
UPD 2020-11-03_13:18:29 18436 lib/FHEM/backupToStorage.pm
UPD 2020-11-03_13:20:01 6242 FHEM/98_backupToStorage.pm
UPD 2020-11-03_13:44:41 18943 lib/FHEM/backupToStorage.pm

View File

@ -204,7 +204,20 @@ sub Notify {
my $devtype = $dev->{TYPE};
my $events = deviceEvents( $dev, 1 );
_CheckIsDisabledAfterSetAttr($hash);
_CheckIsDisabledAfterSetAttr($hash)
if ( (
(
grep m{^DELETEATTR.$name.(disable|disabledForIntervals)$}xms,
@{$events}
or grep m{^ATTR.$name.(disable|disabledForIntervals).\S+$}xms,
@{$events}
)
&& $devname eq 'global'
&& $init_done
)
|| $devname eq $name
);
return if ( !$events
|| IsDisabled($name) );
@ -355,6 +368,8 @@ sub _CheckIsDisabledAfterSetAttr {
my $state = ( IsDisabled($name)
? 'disabled'
: 'ready' );
Log3( $name, 3, "backupToStorage ($name) - _CheckIsDisabledAfterSetAttr" );
readingsSingleUpdate($hash, 'state', $state, 1)
if ( ReadingsVal($name, 'state', 'ready' ) ne $state );