2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

98_WeekdayTimer: add general check for unknown sendsors (contact and state reading)

git-svn-id: https://svn.fhem.de/fhem/trunk@29258 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2024-10-18 05:04:18 +00:00
parent a551c5dc45
commit d3a835fb7e
2 changed files with 11 additions and 5 deletions

View File

@ -4223,6 +4223,7 @@ sub handleCustomIntent {
respond( $hash, $data, $response ); respond( $hash, $data, $response );
return ${$error}[1]; #comma separated list of devices to trigger return ${$error}[1]; #comma separated list of devices to trigger
} elsif ( ref $error eq 'HASH' ) { } elsif ( ref $error eq 'HASH' ) {
$timeout = $error->{sessionTimeout} if defined $error->{sessionTimeout} && looks_like_number( $error->{sessionTimeout} );
return setDialogTimeout($hash, $data, $timeout, $error); return setDialogTimeout($hash, $data, $timeout, $error);
} else { } else {
$response = $error; # if $error && $error !~ m{Please.define.*first}x; $response = $error; # if $error && $error !~ m{Please.define.*first}x;

View File

@ -1166,9 +1166,14 @@ sub checkDelayedExecution {
next; next;
} }
my $fk_typ = $fk_hash->{TYPE}; my $fk_typ = $fk_hash->{TYPE};
my $uknown_state;
if ( !defined $contacts{$fk_typ} ) { if ( !defined $contacts{$fk_typ} ) {
Log3( $hash, 3, "[$name] TYPE '$fk_typ' of $fk not yet supported, $fk ignored - inform maintainer" ); $uknown_state = ReadingsVal($fk,'contact', ReadingsVal($fk,'state',undef ));
next; if ( !defined $uknown_state || $uknown_state !~ m{open|tilt|close}ixms) {
Log3( $hash, 3, "[$name] TYPE '$fk_typ' of $fk not yet supported, $fk ignored - inform maintainer" );
next;
}
$uknown_state = $uknown_state =~ m{open|tilt}ixms ? 'open' : 'closed'; #normalize value
} }
my $reading = $contacts{$fk_typ}{READING}; my $reading = $contacts{$fk_typ}{READING};
@ -1178,13 +1183,13 @@ sub checkDelayedExecution {
my $windowStatus = $model eq 'r' ? ReadingsVal($fk,$reading,'nF') my $windowStatus = $model eq 'r' ? ReadingsVal($fk,$reading,'nF')
: AttrVal ($fk,$reading,'nF'); : AttrVal ($fk,$reading,'nF');
if ( $windowStatus eq 'nF' ) { if ( $windowStatus eq 'nF' && !defined $uknown_state ) {
Log3( $hash, 3, "[$name] Reading/Attribute '$reading' of $fk not found, $fk ignored - inform maintainer" ) if ( $model eq 'r' ); Log3( $hash, 3, "[$name] Reading/Attribute '$reading' of $fk not found, $fk ignored - inform maintainer" ) if ( $model eq 'r' );
next; next;
} }
Log3( $hash, 5, "[$name] sensor '$fk' Reading/Attribute '$reading' is '$windowStatus'" ); Log3( $hash, defined $uknown_state ? 4 : 5, "[$name] sensor '$fk' Reading/Attribute '$reading' is '$windowStatus'" );
if ( $windowStatus =~ m{\A$statusReg\z}xms ) { if ( $windowStatus =~ m{\A$statusReg\z}xms || ( defined $uknown_state && $uknown_state eq 'open' ) ) {
if ( !defined $hash->{DELAYED} ) { if ( !defined $hash->{DELAYED} ) {
Log3( $hash, 3, "[$name] switch of $hash->{DEVICE} delayed - sensor '$fk' Reading/Attribute '$reading' is '$windowStatus'" ); Log3( $hash, 3, "[$name] switch of $hash->{DEVICE} delayed - sensor '$fk' Reading/Attribute '$reading' is '$windowStatus'" );
} }