dev #4
@ -23,7 +23,7 @@
|
|||||||
# Usage:
|
# Usage:
|
||||||
#
|
#
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# $Id: 98_Matrix.pm 14063 2022-11-12 12:52:00Z Man-fred $
|
# $Id$
|
||||||
|
|
||||||
package FHEM::Matrix;
|
package FHEM::Matrix;
|
||||||
use strict;
|
use strict;
|
||||||
@ -63,6 +63,8 @@ sub Initialize {
|
|||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
=item summary Provides a Matrix-Chatbot.
|
=item summary Provides a Matrix-Chatbot.
|
||||||
=item summary_DE Stellt einen Matrix-Chatbot bereit.
|
=item summary_DE Stellt einen Matrix-Chatbot bereit.
|
||||||
@ -359,4 +361,48 @@ sub Initialize {
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
=end html_DE
|
=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": [
|
||||||
|
"<a href=https://forum.fhem.de/index.php?action=profile;u=41965>mBielemeier </a>"
|
||||||
|
],
|
||||||
|
"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
|
=cut
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Usage:
|
# Usage:
|
||||||
#
|
#
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# $Id: Matrix.pm 22821 2022-11-12 12:52:00Z Man-fred $
|
# $Id$
|
||||||
#
|
#
|
||||||
# from the developerpages:
|
# from the developerpages:
|
||||||
# Verwendung von lowerCamelCaps für a) die Bezeichnungen der Behälter für Readings, Fhem und Helper und der Untereintraege,
|
# 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 {
|
sub Attr_List {
|
||||||
return
|
return
|
||||||
"matrixLogin:password matrixRoom matrixPoll:0,1 matrixSender matrixMessage matrixQuestion_ matrixQuestion_[0-9]+ matrixAnswer_ matrixAnswer_[0-9]+ $readingFnAttributes";
|
"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 $hash = shift;
|
||||||
my $aArg = 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 <name> Matrix <server> <user>'
|
return 'too few parameters: define <name> Matrix <server> <user>'
|
||||||
if ( scalar( @{$aArg} ) != 4 );
|
if ( scalar( @{$aArg} ) != 4 );
|
||||||
|
|
||||||
@ -1584,13 +1588,7 @@ sub _PerformHttpRequestOrInternalTimerFAIL {
|
|||||||
Log3( $name, 4, "$name : Matrix::ParseHttpResponse $hash" );
|
Log3( $name, 4, "$name : Matrix::ParseHttpResponse $hash" );
|
||||||
if ( AttrVal( $name, 'matrixPoll', 0 ) == 1 ) {
|
if ( AttrVal( $name, 'matrixPoll', 0 ) == 1 ) {
|
||||||
if ( $nextRequest ne '' && $hash->{helper}->{softfail} < 3 ) {
|
if ( $nextRequest ne '' && $hash->{helper}->{softfail} < 3 ) {
|
||||||
if ( $nextRequest eq 'sync' && $hash->{helper}->{repeat} ) {
|
if ( !_SyncNextRequest( $hash, $nextRequest ) ) {
|
||||||
$def = $hash->{helper}->{repeat}->{def};
|
|
||||||
$value = $hash->{helper}->{repeat}->{value};
|
|
||||||
$hash->{helper}->{repeat} = undef;
|
|
||||||
_PerformHttpRequest( $hash, $def, $value );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_PerformHttpRequest( $hash, $nextRequest, '' );
|
_PerformHttpRequest( $hash, $nextRequest, '' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1615,6 +1613,32 @@ sub _PerformHttpRequestOrInternalTimerFAIL {
|
|||||||
\&FHEM::Devices::Matrix::Client::Login, $hash );
|
\&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;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user