diff --git a/FHEM/70_Matrix.pm b/FHEM/70_Matrix.pm
index 5565e79..57784d3 100644
--- a/FHEM/70_Matrix.pm
+++ b/FHEM/70_Matrix.pm
@@ -23,7 +23,7 @@
# Usage:
#
##########################################################################
-# $Id: 98_Matrix.pm 14063 2022-11-12 12:52:00Z Man-fred $
+# $Id$
package FHEM::Matrix;
use strict;
@@ -63,6 +63,8 @@ sub Initialize {
1;
+__END__
+
=pod
=item summary Provides a Matrix-Chatbot.
=item summary_DE Stellt einen Matrix-Chatbot bereit.
@@ -359,4 +361,48 @@ sub Initialize {
=end html_DE
+
+=for :application/json;q=META.json 70_Matrix.pm.pm
+{
+ "abstract": "Provides a Matrix-Chatbot",
+ "x_lang": {
+ "de": {
+ "abstract": "Stellt einen Matrix-Chatbot bereit"
+ }
+ },
+ "version": "v0.15.3",
+ "author": [
+ "Manfred Bielemeier"
+ ],
+ "x_fhem_maintainer": [
+ "mBielemeier "
+ ],
+ "x_fhem_maintainer_github": [
+ "Man-fred"
+ ],
+ "prereqs": {
+ "runtime": {
+ "requires": {
+ "FHEM::Meta": 0,
+ "HttpUtils": 0,
+ "strict": 0,
+ "warnings": 0,
+ "experimental": 0,
+ "carp": 0,
+ "POSIX": 0,
+ "JSON::PP": 0,
+ "encode": 0,
+ },
+ "recommends": {
+ "JSON": 0
+ },
+ "suggests": {
+ "JSON::XS": 0,
+ "Cpanel::JSON::XS": 0
+ }
+ }
+ }
+}
+=end :application/json;q=META.json
+
=cut
diff --git a/lib/FHEM/Devices/Matrix/Client.pm b/lib/FHEM/Devices/Matrix/Client.pm
index 7b962ff..40c9ebb 100644
--- a/lib/FHEM/Devices/Matrix/Client.pm
+++ b/lib/FHEM/Devices/Matrix/Client.pm
@@ -2,7 +2,7 @@
# Usage:
#
##########################################################################
-# $Id: Matrix.pm 22821 2022-11-12 12:52:00Z Man-fred $
+# $Id$
#
# from the developerpages:
# Verwendung von lowerCamelCaps für a) die Bezeichnungen der Behälter für Readings, Fhem und Helper und der Untereintraege,
@@ -108,8 +108,6 @@ BEGIN {
);
}
-my $VERSION = '0.0.15';
-
sub Attr_List {
return
"matrixLogin:password matrixRoom matrixPoll:0,1 matrixSender matrixMessage matrixQuestion_ matrixQuestion_[0-9]+ matrixAnswer_ matrixAnswer_[0-9]+ $readingFnAttributes";
@@ -121,6 +119,12 @@ sub Define {
my $hash = shift;
my $aArg = shift;
+ my $version;
+
+ return $@ unless ( FHEM::Meta::SetInternals($hash) );
+ $version = FHEM::Meta::Get( $hash, 'version' );
+ use version 0.77; our $VERSION = $version;
+
return 'too few parameters: define Matrix '
if ( scalar( @{$aArg} ) != 4 );
@@ -1584,13 +1588,7 @@ sub _PerformHttpRequestOrInternalTimerFAIL {
Log3( $name, 4, "$name : Matrix::ParseHttpResponse $hash" );
if ( AttrVal( $name, 'matrixPoll', 0 ) == 1 ) {
if ( $nextRequest ne '' && $hash->{helper}->{softfail} < 3 ) {
- if ( $nextRequest eq 'sync' && $hash->{helper}->{repeat} ) {
- $def = $hash->{helper}->{repeat}->{def};
- $value = $hash->{helper}->{repeat}->{value};
- $hash->{helper}->{repeat} = undef;
- _PerformHttpRequest( $hash, $def, $value );
- }
- else {
+ if ( !_SyncNextRequest( $hash, $nextRequest ) ) {
_PerformHttpRequest( $hash, $nextRequest, '' );
}
}
@@ -1615,6 +1613,32 @@ sub _PerformHttpRequestOrInternalTimerFAIL {
\&FHEM::Devices::Matrix::Client::Login, $hash );
}
}
+ elsif ( $hash->{helper}->{softfail} < 3 ) {
+ if ( $nextRequest eq 'login' ) {
+ _PerformHttpRequest( $hash, $nextRequest, '' );
+ }
+
+ _SyncNextRequest( $hash, $nextRequest );
+ }
+
+ return;
+}
+
+sub _SyncNextRequest {
+ return 0
+ unless ( __PACKAGE__ eq caller(0) )
+ ; # nur das eigene Package darf private Funktionen aufrufen (CoolTux)
+
+ my $hash = shift;
+ my $nextRequest = shift;
+
+ if ( $nextRequest eq 'sync' && $hash->{helper}->{repeat} ) {
+ $def = $hash->{helper}->{repeat}->{def};
+ $value = $hash->{helper}->{repeat}->{value};
+ $hash->{helper}->{repeat} = undef;
+
+ return _PerformHttpRequest( $hash, $def, $value );
+ }
return;
}