fix first start and set state reading
geändert: lib/FHEM/backupToStorage.pm
This commit is contained in:
parent
3d029ab6f2
commit
bc18022177
@ -1,2 +1,2 @@
|
|||||||
UPD 2020-06-17_15:03:50 3368 FHEM/98_backupToStorage.pm
|
UPD 2020-06-17_15:03:50 3368 FHEM/98_backupToStorage.pm
|
||||||
UPD 2020-06-17_15:30:50 10123 lib/FHEM/backupToStorage.pm
|
UPD 2020-06-17_15:39:04 10502 lib/FHEM/backupToStorage.pm
|
||||||
|
@ -79,17 +79,6 @@ sub Define {
|
|||||||
$hash->{VERSION} = version->parse($VERSION)->normal;
|
$hash->{VERSION} = version->parse($VERSION)->normal;
|
||||||
$hash->{NOTIFYDEV} = 'global';
|
$hash->{NOTIFYDEV} = 'global';
|
||||||
|
|
||||||
readingsSingleUpdate( $hash, 'state',
|
|
||||||
(
|
|
||||||
(AttrVal( $name, 'bTS_Host', 'none' ) eq 'none'
|
|
||||||
|| AttrVal( $name, 'bTS_User', 'none' ) eq 'none'
|
|
||||||
|| !defined( ReadPassword( $hash, $name ) ) )
|
|
||||||
? 'please set storage account credentials first'
|
|
||||||
: 'ready'
|
|
||||||
)
|
|
||||||
, 1
|
|
||||||
);
|
|
||||||
|
|
||||||
Log3( $name, 3, "backupToStorage ($name) - defined" );
|
Log3( $name, 3, "backupToStorage ($name) - defined" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -143,20 +132,44 @@ sub Notify {
|
|||||||
. Dumper $events); # mit Dumper
|
. Dumper $events); # mit Dumper
|
||||||
|
|
||||||
PushToStorage($hash)
|
PushToStorage($hash)
|
||||||
if ( grep /^backup.done/,
|
if ( grep m{^backup.done}xms,
|
||||||
@{$events} && $devname eq 'global' && $init_done );
|
@{$events} && $devname eq 'global' && $init_done );
|
||||||
|
|
||||||
CheckAttributsForCredentials($hash)
|
CheckAttributsForCredentials($hash)
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
grep /^DELETEATTR.$name.(bTS_Host|bTS_User)$/,
|
grep m{^DELETEATTR.$name.(bTS_Host|bTS_User)$}xms,
|
||||||
@{$events}
|
@{$events}
|
||||||
or grep /^ATTR.$name.(bTS_Host|bTS_User).\S+$/,
|
or grep m{^ATTR.$name.(bTS_Host|bTS_User).\S+$}xms,
|
||||||
@{$events}
|
@{$events}
|
||||||
)
|
)
|
||||||
&& $devname eq 'global'
|
&& $devname eq 'global'
|
||||||
&& $init_done
|
&& $init_done
|
||||||
);
|
);
|
||||||
|
|
||||||
|
readingsSingleUpdate( $hash, 'state',
|
||||||
|
(
|
||||||
|
(AttrVal( $name, 'bTS_Host', 'none' ) eq 'none'
|
||||||
|
|| AttrVal( $name, 'bTS_User', 'none' ) eq 'none'
|
||||||
|
|| !defined( ReadPassword( $hash, $name ) ) )
|
||||||
|
? 'please set storage account credentials first'
|
||||||
|
: 'ready'
|
||||||
|
)
|
||||||
|
, 1
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
grep m{^DEFINED.$name$}xms,
|
||||||
|
@{$events} && $devname eq 'global' && $init_done
|
||||||
|
)
|
||||||
|
|| (
|
||||||
|
grep m{^INITIALIZED$}xms,
|
||||||
|
@{$events} or grep m{^REREADCFG$}xms,
|
||||||
|
@{$events} or grep m{^MODIFIED.$name$}xms,
|
||||||
|
@{$events}
|
||||||
|
)
|
||||||
|
&& $devname eq 'global'
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user