mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
50_SSChatBot.pm: module to integrate Synology Chat Server (SSCam is also updated due to compatibility)
git-svn-id: https://svn.fhem.de/fhem/trunk@22620 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e203879aeb
commit
c2ea4ae39d
@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- new: 50_SSChatBot.pm: module to integrate Synology Chat Server
|
||||||
|
(SSCam is also updated due to compatibility)
|
||||||
- feature: 14_FLAMINGO.pm: fix some perlcritic 5 warnings
|
- feature: 14_FLAMINGO.pm: fix some perlcritic 5 warnings
|
||||||
- feature: 98_DOIFtools: get subsInPackageDOIF for MODEL Perl (Forum #63938)
|
- feature: 98_DOIFtools: get subsInPackageDOIF for MODEL Perl (Forum #63938)
|
||||||
- bugfix: 49_SSCam(STRM): avoid possible warnings during shutdown/restart
|
- bugfix: 49_SSCam(STRM): avoid possible warnings during shutdown/restart
|
||||||
|
@ -136,9 +136,9 @@ BEGIN {
|
|||||||
TelegramBot_AttrNum
|
TelegramBot_AttrNum
|
||||||
TelegramBot_Callback
|
TelegramBot_Callback
|
||||||
TelegramBot_BinaryFileRead
|
TelegramBot_BinaryFileRead
|
||||||
SSChatBot_formString
|
FHEM::SSChatBot::formString
|
||||||
SSChatBot_addQueue
|
FHEM::SSChatBot::addQueue
|
||||||
SSChatBot_getapisites
|
FHEM::SSChatBot::getApiSites
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -159,6 +159,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"9.7.0" => "17.08.2020 compatibility to SSChatBot version 1.10.0 ",
|
||||||
"9.6.1" => "13.08.2020 avoid warnings during FHEM shutdown/restart ",
|
"9.6.1" => "13.08.2020 avoid warnings during FHEM shutdown/restart ",
|
||||||
"9.6.0" => "12.08.2020 new attribute ptzNoCapPrePat ",
|
"9.6.0" => "12.08.2020 new attribute ptzNoCapPrePat ",
|
||||||
"9.5.3" => "27.07.2020 fix warning: Use of uninitialized value in subroutine dereference at ... ",
|
"9.5.3" => "27.07.2020 fix warning: Use of uninitialized value in subroutine dereference at ... ",
|
||||||
@ -684,7 +685,7 @@ sub Define {
|
|||||||
|
|
||||||
return "Error: Perl module ".$SScamMMDBI." is missing. Install it on Debian with: sudo apt-get install libjson-perl" if($SScamMMDBI);
|
return "Error: Perl module ".$SScamMMDBI." is missing. Install it on Debian with: sudo apt-get install libjson-perl" if($SScamMMDBI);
|
||||||
|
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split m{\s+}x, $def;
|
||||||
|
|
||||||
if(int(@a) < 4) {
|
if(int(@a) < 4) {
|
||||||
return "You need to specify more parameters.\n". "Format: define <name> SSCAM <Cameraname> <ServerAddress> [Port]";
|
return "You need to specify more parameters.\n". "Format: define <name> SSCAM <Cameraname> <ServerAddress> [Port]";
|
||||||
@ -9720,7 +9721,7 @@ sub sendChat {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $type = AttrVal($name,"cacheType","internal");
|
my $type = AttrVal($name,"cacheType","internal");
|
||||||
my $mtype = "";
|
my $mtype = "";
|
||||||
my ($ret,$cache);
|
my ($params,$ret,$cache);
|
||||||
|
|
||||||
Log3($name, 4, "$name - ####################################################");
|
Log3($name, 4, "$name - ####################################################");
|
||||||
Log3($name, 4, "$name - ### start send Snap or Video by SSChatBot ");
|
Log3($name, 4, "$name - ### start send Snap or Video by SSChatBot ");
|
||||||
@ -9835,8 +9836,19 @@ sub sendChat {
|
|||||||
# Eintrag zur SendQueue hinzufügen
|
# Eintrag zur SendQueue hinzufügen
|
||||||
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
||||||
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
||||||
$subject = SSChatBot_formString ($subject, "text");
|
$subject = FHEM::SSChatBot::formString ($subject, "text");
|
||||||
$ret = SSChatBot_addQueue ($chatbot, "sendItem", "chatbot", $uid, $subject, $fileUrl, "", "");
|
|
||||||
|
$params = {
|
||||||
|
name => $chatbot,
|
||||||
|
opmode => "sendItem",
|
||||||
|
method => "chatbot",
|
||||||
|
userid => $uid,
|
||||||
|
text => $subject,
|
||||||
|
fileUrl => $fileUrl,
|
||||||
|
channel => "",
|
||||||
|
attachment => ""
|
||||||
|
};
|
||||||
|
$ret = FHEM::SSChatBot::addQueue ($params);
|
||||||
|
|
||||||
if($ret) {
|
if($ret) {
|
||||||
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
||||||
@ -9895,8 +9907,19 @@ sub sendChat {
|
|||||||
# Eintrag zur SendQueue hinzufügen
|
# Eintrag zur SendQueue hinzufügen
|
||||||
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
||||||
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
||||||
$subject = SSChatBot_formString ($subject, "text");
|
$subject = FHEM::SSChatBot::formString ($subject, "text");
|
||||||
$ret = SSChatBot_addQueue ($chatbot, "sendItem", "chatbot", $uid, $subject, $fileUrl, "", "");
|
|
||||||
|
$params = {
|
||||||
|
name => $chatbot,
|
||||||
|
opmode => "sendItem",
|
||||||
|
method => "chatbot",
|
||||||
|
userid => $uid,
|
||||||
|
text => $subject,
|
||||||
|
fileUrl => $fileUrl,
|
||||||
|
channel => "",
|
||||||
|
attachment => ""
|
||||||
|
};
|
||||||
|
$ret = FHEM::SSChatBot::addQueue ($params);
|
||||||
|
|
||||||
if($ret) {
|
if($ret) {
|
||||||
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
||||||
@ -9913,7 +9936,7 @@ sub sendChat {
|
|||||||
Log3($name, 1, "$name - Send Counter transaction \"$tac\": ".$data{SSCam}{$name}{SENDCOUNT}{$tac}) if(AttrVal($name,"debugactivetoken",0));
|
Log3($name, 1, "$name - Send Counter transaction \"$tac\": ".$data{SSCam}{$name}{SENDCOUNT}{$tac}) if(AttrVal($name,"debugactivetoken",0));
|
||||||
}
|
}
|
||||||
|
|
||||||
SSChatBot_getapisites($chatbot); # Übertragung Sendqueue starten
|
FHEM::SSChatBot::getApiSites ($chatbot); # Übertragung Sendqueue starten
|
||||||
|
|
||||||
# use strict "refs";
|
# use strict "refs";
|
||||||
undef %chatparams;
|
undef %chatparams;
|
||||||
|
2972
fhem/FHEM/50_SSChatBot.pm
Normal file
2972
fhem/FHEM/50_SSChatBot.pm
Normal file
File diff suppressed because it is too large
Load Diff
@ -264,6 +264,7 @@ FHEM/49_SSCamSTRM.pm DS_Starter Sonstiges
|
|||||||
FHEM/49_TBot_List.pm viegener Unterstützende Dienste
|
FHEM/49_TBot_List.pm viegener Unterstützende Dienste
|
||||||
FHEM/50_HP1000.pm loredo Unterstützende Dienste/Wettermodule
|
FHEM/50_HP1000.pm loredo Unterstützende Dienste/Wettermodule
|
||||||
FHEM/50_MOBILEALERTSGW.pm MarkusF Sonstige Systeme
|
FHEM/50_MOBILEALERTSGW.pm MarkusF Sonstige Systeme
|
||||||
|
FHEM/50_SSChatBot.pm DS_Starter Sonstiges
|
||||||
FHEM/50_TelegramBot.pm viegener Unterstützende Dienste
|
FHEM/50_TelegramBot.pm viegener Unterstützende Dienste
|
||||||
FHEM/50_WS300.pm Dirk SlowRF
|
FHEM/50_WS300.pm Dirk SlowRF
|
||||||
FHEM/51_I2C_BH1750.pm arnoaugustin Einplatinencomputer (bitte auch PM)
|
FHEM/51_I2C_BH1750.pm arnoaugustin Einplatinencomputer (bitte auch PM)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
# $Id: 49_SSCam.pm 22592 2020-08-12 21:28:56Z DS_Starter $
|
# $Id: 49_SSCam.pm 22600 2020-08-14 19:22:36Z DS_Starter $
|
||||||
#########################################################################################################################
|
#########################################################################################################################
|
||||||
# 49_SSCam.pm
|
# 49_SSCam.pm
|
||||||
#
|
#
|
||||||
@ -136,9 +136,9 @@ BEGIN {
|
|||||||
TelegramBot_AttrNum
|
TelegramBot_AttrNum
|
||||||
TelegramBot_Callback
|
TelegramBot_Callback
|
||||||
TelegramBot_BinaryFileRead
|
TelegramBot_BinaryFileRead
|
||||||
SSChatBot_formString
|
FHEM::SSChatBot::formString
|
||||||
SSChatBot_addQueue
|
FHEM::SSChatBot::addQueue
|
||||||
SSChatBot_getapisites
|
FHEM::SSChatBot::getApiSites
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -159,6 +159,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"9.7.0" => "17.08.2020 compatibility to SSChatBot version 1.10.0 ",
|
||||||
"9.6.1" => "13.08.2020 avoid warnings during FHEM shutdown/restart ",
|
"9.6.1" => "13.08.2020 avoid warnings during FHEM shutdown/restart ",
|
||||||
"9.6.0" => "12.08.2020 new attribute ptzNoCapPrePat ",
|
"9.6.0" => "12.08.2020 new attribute ptzNoCapPrePat ",
|
||||||
"9.5.3" => "27.07.2020 fix warning: Use of uninitialized value in subroutine dereference at ... ",
|
"9.5.3" => "27.07.2020 fix warning: Use of uninitialized value in subroutine dereference at ... ",
|
||||||
@ -684,7 +685,7 @@ sub Define {
|
|||||||
|
|
||||||
return "Error: Perl module ".$SScamMMDBI." is missing. Install it on Debian with: sudo apt-get install libjson-perl" if($SScamMMDBI);
|
return "Error: Perl module ".$SScamMMDBI." is missing. Install it on Debian with: sudo apt-get install libjson-perl" if($SScamMMDBI);
|
||||||
|
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split m{\s+}x, $def;
|
||||||
|
|
||||||
if(int(@a) < 4) {
|
if(int(@a) < 4) {
|
||||||
return "You need to specify more parameters.\n". "Format: define <name> SSCAM <Cameraname> <ServerAddress> [Port]";
|
return "You need to specify more parameters.\n". "Format: define <name> SSCAM <Cameraname> <ServerAddress> [Port]";
|
||||||
@ -9720,7 +9721,7 @@ sub sendChat {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $type = AttrVal($name,"cacheType","internal");
|
my $type = AttrVal($name,"cacheType","internal");
|
||||||
my $mtype = "";
|
my $mtype = "";
|
||||||
my ($ret,$cache);
|
my ($params,$ret,$cache);
|
||||||
|
|
||||||
Log3($name, 4, "$name - ####################################################");
|
Log3($name, 4, "$name - ####################################################");
|
||||||
Log3($name, 4, "$name - ### start send Snap or Video by SSChatBot ");
|
Log3($name, 4, "$name - ### start send Snap or Video by SSChatBot ");
|
||||||
@ -9835,8 +9836,19 @@ sub sendChat {
|
|||||||
# Eintrag zur SendQueue hinzufügen
|
# Eintrag zur SendQueue hinzufügen
|
||||||
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
||||||
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
||||||
$subject = SSChatBot_formString ($subject, "text");
|
$subject = FHEM::SSChatBot::formString ($subject, "text");
|
||||||
$ret = SSChatBot_addQueue ($chatbot, "sendItem", "chatbot", $uid, $subject, $fileUrl, "", "");
|
|
||||||
|
$params = {
|
||||||
|
name => $chatbot,
|
||||||
|
opmode => "sendItem",
|
||||||
|
method => "chatbot",
|
||||||
|
userid => $uid,
|
||||||
|
text => $subject,
|
||||||
|
fileUrl => $fileUrl,
|
||||||
|
channel => "",
|
||||||
|
attachment => ""
|
||||||
|
};
|
||||||
|
$ret = FHEM::SSChatBot::addQueue ($params);
|
||||||
|
|
||||||
if($ret) {
|
if($ret) {
|
||||||
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
||||||
@ -9895,8 +9907,19 @@ sub sendChat {
|
|||||||
# Eintrag zur SendQueue hinzufügen
|
# Eintrag zur SendQueue hinzufügen
|
||||||
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
# Werte: (name,opmode,method,userid,text,fileUrl,channel,attachment)
|
||||||
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
$fileUrl = $rootUrl."/".$mtype."/".$fname;
|
||||||
$subject = SSChatBot_formString ($subject, "text");
|
$subject = FHEM::SSChatBot::formString ($subject, "text");
|
||||||
$ret = SSChatBot_addQueue ($chatbot, "sendItem", "chatbot", $uid, $subject, $fileUrl, "", "");
|
|
||||||
|
$params = {
|
||||||
|
name => $chatbot,
|
||||||
|
opmode => "sendItem",
|
||||||
|
method => "chatbot",
|
||||||
|
userid => $uid,
|
||||||
|
text => $subject,
|
||||||
|
fileUrl => $fileUrl,
|
||||||
|
channel => "",
|
||||||
|
attachment => ""
|
||||||
|
};
|
||||||
|
$ret = FHEM::SSChatBot::addQueue ($params);
|
||||||
|
|
||||||
if($ret) {
|
if($ret) {
|
||||||
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
readingsSingleUpdate($hash, "sendChatState", $ret, 1);
|
||||||
@ -9913,7 +9936,7 @@ sub sendChat {
|
|||||||
Log3($name, 1, "$name - Send Counter transaction \"$tac\": ".$data{SSCam}{$name}{SENDCOUNT}{$tac}) if(AttrVal($name,"debugactivetoken",0));
|
Log3($name, 1, "$name - Send Counter transaction \"$tac\": ".$data{SSCam}{$name}{SENDCOUNT}{$tac}) if(AttrVal($name,"debugactivetoken",0));
|
||||||
}
|
}
|
||||||
|
|
||||||
SSChatBot_getapisites($chatbot); # Übertragung Sendqueue starten
|
FHEM::SSChatBot::getApiSites ($chatbot); # Übertragung Sendqueue starten
|
||||||
|
|
||||||
# use strict "refs";
|
# use strict "refs";
|
||||||
undef %chatparams;
|
undef %chatparams;
|
||||||
@ -11441,12 +11464,12 @@ sub setVersionInfo {
|
|||||||
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
||||||
# META-Daten sind vorhanden
|
# META-Daten sind vorhanden
|
||||||
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
|
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
|
||||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 49_SSCam.pm 22592 2020-08-12 21:28:56Z DS_Starter $ im Kopf komplett! vorhanden )
|
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 49_SSCam.pm 22600 2020-08-14 19:22:36Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||||
$modules{$type}{META}{x_version} =~ s/1\.1\.1/$v/gx;
|
$modules{$type}{META}{x_version} =~ s/1\.1\.1/$v/gx;
|
||||||
} else {
|
} else {
|
||||||
$modules{$type}{META}{x_version} = $v;
|
$modules{$type}{META}{x_version} = $v;
|
||||||
}
|
}
|
||||||
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 49_SSCam.pm 22592 2020-08-12 21:28:56Z DS_Starter $ im Kopf komplett! vorhanden )
|
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 49_SSCam.pm 22600 2020-08-14 19:22:36Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||||
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
||||||
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
||||||
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user