diff --git a/fhem/FHEM/10_RHASSPY.pm b/fhem/FHEM/10_RHASSPY.pm index df2fa2684..410ca4975 100644 --- a/fhem/FHEM/10_RHASSPY.pm +++ b/fhem/FHEM/10_RHASSPY.pm @@ -3346,6 +3346,20 @@ sub RHASSPY_SpeechDialogTimeout { return SpeechDialog_close($hash, $identity); } +sub RHASSPY_reopenVoiceInput_timeout { + my $fnHash = shift // return; + my $hash = $fnHash->{HASH} // $fnHash; + return if !defined $hash; + my $identity = $fnHash->{MODIFIER}; + deleteSingleRegIntTimer($identity, $hash, 1); + Log3($hash, 5, "RHASSPY_reopenVoiceInput_timeout called with $identity"); + #Beta-User: incomplete, closing voice input is still missing! + #Here we might have to delete any remaining data from a "continuous" session.... + + return; +} + + sub setSpeechDialogTimeout { my $hash = shift // return; my $data = shift // return; @@ -3734,8 +3748,10 @@ sub respond { if ( $topic ne 'continueSession' && $type eq 'voice' && ( defined $data->{reopenVoiceInput} || defined $hash->{sessionTimeout} ) ) { activateVoiceInput($hash,[$data->{siteId}]); $delay = ReadingsNum($name, "sessionTimeout_$data->{siteId}", $hash->{sessionTimeout} // _getDialogueTimeout($hash)); - $delay = $data->{SilentClosure} if defined $data->{SilentClosure} && looks_like_number($data->{SilentClosure}); - resetRegIntTimer( 'testmode_end', time + $delay, \&RHASSPY_testmode_timeout, $hash ); #Beta-User: needs different timeout function + $delay = $data->{SilentClosure} if defined $data->{SilentClosure} && looks_like_number($data->{SilentClosure}); + $delay = $data->{reopenVoiceInput} if !defined $data->{SilentClosure} && defined $data->{reopenVoiceInput} && looks_like_number($data->{reopenVoiceInput} && $data->{reopenVoiceInput} > 0); + #Beta-User: timeout function needs review, esp. in case if we store any session data + resetRegIntTimer( 'testmode_end', time + $delay, \&RHASSPY_reopenVoiceInput_timeout, $hash ); } my $secondAudio = ReadingsVal($name, "siteId2doubleSpeak_$data->{siteId}",undef) // return [$name];