From d3a835fb7ece09da384882a466f290bef7b2905f Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Fri, 18 Oct 2024 05:04:18 +0000 Subject: [PATCH] 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 --- fhem/FHEM/10_RHASSPY.pm | 1 + fhem/FHEM/98_WeekdayTimer.pm | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/10_RHASSPY.pm b/fhem/FHEM/10_RHASSPY.pm index 69e3ff46c..5295d96af 100644 --- a/fhem/FHEM/10_RHASSPY.pm +++ b/fhem/FHEM/10_RHASSPY.pm @@ -4223,6 +4223,7 @@ sub handleCustomIntent { respond( $hash, $data, $response ); return ${$error}[1]; #comma separated list of devices to trigger } elsif ( ref $error eq 'HASH' ) { + $timeout = $error->{sessionTimeout} if defined $error->{sessionTimeout} && looks_like_number( $error->{sessionTimeout} ); return setDialogTimeout($hash, $data, $timeout, $error); } else { $response = $error; # if $error && $error !~ m{Please.define.*first}x; diff --git a/fhem/FHEM/98_WeekdayTimer.pm b/fhem/FHEM/98_WeekdayTimer.pm index 0a40d3454..30ad3b4f1 100644 --- a/fhem/FHEM/98_WeekdayTimer.pm +++ b/fhem/FHEM/98_WeekdayTimer.pm @@ -1166,9 +1166,14 @@ sub checkDelayedExecution { next; } my $fk_typ = $fk_hash->{TYPE}; + my $uknown_state; if ( !defined $contacts{$fk_typ} ) { - Log3( $hash, 3, "[$name] TYPE '$fk_typ' of $fk not yet supported, $fk ignored - inform maintainer" ); - next; + $uknown_state = ReadingsVal($fk,'contact', ReadingsVal($fk,'state',undef )); + 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}; @@ -1178,13 +1183,13 @@ sub checkDelayedExecution { my $windowStatus = $model eq 'r' ? ReadingsVal($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' ); 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} ) { Log3( $hash, 3, "[$name] switch of $hash->{DEVICE} delayed - sensor '$fk' Reading/Attribute '$reading' is '$windowStatus'" ); }