1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 22:19:38 +00:00

synomodules: Update Synology lib modules

git-svn-id: https://svn.fhem.de/fhem/trunk@27415 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-04-08 20:33:35 +00:00
parent 3cdbfdebce
commit e67a7741fa
4 changed files with 38 additions and 19 deletions

View File

@ -1,5 +1,6 @@
# 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.
- change: Update Synology lib modules
- bugfix: 72_FRITZBOX: Fehlerkorrekturen: u.a. Verhalten bei disable - bugfix: 72_FRITZBOX: Fehlerkorrekturen: u.a. Verhalten bei disable
feature: attr nonblockingTimeOut <50|75|100|125> feature: attr nonblockingTimeOut <50|75|100|125>
feature: fritzLog zusätzlich mit blocking sub (commandRef) feature: fritzLog zusätzlich mit blocking sub (commandRef)

View File

@ -3,7 +3,7 @@
######################################################################################################################### #########################################################################################################################
# API.pm # API.pm
# #
# (c) 2020 - 2022 by Heiko Maaz # (c) 2020 - 2023 by Heiko Maaz
# e-mail: Heiko dot Maaz at t-online dot de # e-mail: Heiko dot Maaz at t-online dot de
# #
# This Module provides Synology API information. # This Module provides Synology API information.
@ -24,6 +24,11 @@
# along with fhem. If not, see <http://www.gnu.org/licenses/>. # along with fhem. If not, see <http://www.gnu.org/licenses/>.
# #
######################################################################################################################### #########################################################################################################################
#
# 08.04.2023 1.4.0 add SYNO.Chat.Post to _staticChat
#
#
#
package FHEM::SynoModules::API; package FHEM::SynoModules::API;
@ -32,7 +37,7 @@ use warnings;
use utf8; use utf8;
use Carp qw(croak carp); use Carp qw(croak carp);
use version; our $VERSION = version->declare('1.3.0'); use version; our $VERSION = version->declare('1.4.0');
# use lib qw(/opt/fhem/FHEM /opt/fhem/lib); # für Syntaxcheck mit: perl -c /opt/fhem/lib/FHEM/SynoModules/API.pm # use lib qw(/opt/fhem/FHEM /opt/fhem/lib); # für Syntaxcheck mit: perl -c /opt/fhem/lib/FHEM/SynoModules/API.pm
@ -102,11 +107,14 @@ return \%hapi;
######################################################################## ########################################################################
# Liefert die statischen Informationen der Chat API # Liefert die statischen Informationen der Chat API
# mk : 1 - API Key muss vorhanden sein
# 0 - API Key kann vorhanden sein
######################################################################## ########################################################################
sub _staticChat { sub _staticChat {
my %hapi = ( my %hapi = (
INFO => { NAME => "SYNO.API.Info", mk => 1 }, INFO => { NAME => "SYNO.API.Info", mk => 1 },
EXTERNAL => { NAME => "SYNO.Chat.External", mk => 1 }, EXTERNAL => { NAME => "SYNO.Chat.External", mk => 1 },
POST => { NAME => "SYNO.Chat.Post", mk => 1 },
); );
return \%hapi; return \%hapi;
@ -114,6 +122,8 @@ return \%hapi;
######################################################################## ########################################################################
# Liefert die statischen Informationen der Calendar API # Liefert die statischen Informationen der Calendar API
# mk : 1 - API Key muss vorhanden sein
# 0 - API Key kann vorhanden sein
######################################################################## ########################################################################
sub _staticCalendar { sub _staticCalendar {
my %hapi = ( my %hapi = (

View File

@ -3,7 +3,7 @@
######################################################################################################################### #########################################################################################################################
# ErrCodes.pm # ErrCodes.pm
# #
# (c) 2020 - 2022 by Heiko Maaz # (c) 2020 - 2023 by Heiko Maaz
# e-mail: Heiko dot Maaz at t-online dot de # e-mail: Heiko dot Maaz at t-online dot de
# #
# This Module provides Synology API Error Codes. # This Module provides Synology API Error Codes.
@ -32,7 +32,7 @@ use warnings;
use utf8; use utf8;
use Carp qw(croak carp); use Carp qw(croak carp);
use version; our $VERSION = version->declare('1.3.6'); use version; our $VERSION = version->declare('1.3.7');
use Exporter ('import'); use Exporter ('import');
our @EXPORT_OK = qw(expErrorsAuth expErrors); our @EXPORT_OK = qw(expErrorsAuth expErrors);
@ -166,12 +166,15 @@ my %errsschat = ( # Standa
100 => "Unknown error", 100 => "Unknown error",
101 => "Payload is empty", 101 => "Payload is empty",
102 => "API does not exist - may be the Synology Chat Server package is stopped", 102 => "API does not exist - may be the Synology Chat Server package is stopped",
105 => "Insufficient user privilege",
117 => "illegal file name or path", 117 => "illegal file name or path",
119 => "Invalid cookie in POST request",
120 => "payload has wrong format", 120 => "payload has wrong format",
404 => "bot is not legal - may be the bot is not active or the botToken is wrong", 404 => "bot is not legal - may be the bot is not active or the botToken is wrong",
407 => "record not valid", 407 => "record not valid",
409 => "exceed max file size", 409 => "exceed max file size",
410 => "message too long", 410 => "message too long",
415 => "Post exceeds allowable delete time (Post ID might be already deleted or is not available)",
800 => "malformed or unsupported URL", 800 => "malformed or unsupported URL",
805 => "empty API data received - may be the Synology Chat Server package is stopped", 805 => "empty API data received - may be the Synology Chat Server package is stopped",
806 => "couldn't get Synology Chat API informations", 806 => "couldn't get Synology Chat API informations",

View File

@ -26,17 +26,18 @@
######################################################################################################################### #########################################################################################################################
# Version History # Version History
# 1.25.0 new sub timestampToDateTime # 1.26.0 08.04.2023 add postid to _addSendqueueExtended
# 1.24.2 fix evalDecodeJSON return # 1.25.0 new sub timestampToDateTime
# 1.24.2 fix evaljson return # 1.24.2 fix evalDecodeJSON return
# 1.24.1 extend moduleVersion by useCTZ # 1.24.2 fix evaljson return
# 1.24.0 new sub encodeSpecChars # 1.24.1 extend moduleVersion by useCTZ
# 1.23.1 correct version format # 1.24.0 new sub encodeSpecChars
# 1.23.0 new sub evalDecodeJSON # 1.23.1 correct version format
# 1.22.0 new sub addCHANGED # 1.23.0 new sub evalDecodeJSON
# 1.21.0 new sub timestringToTimestamp / createReadingsFromArray # 1.22.0 new sub addCHANGED
# 1.20.7 change to defined ... in sub _addSendqueueSimple # 1.21.0 new sub timestringToTimestamp / createReadingsFromArray
# 1.20.6 delete $hash->{OPMODE} in checkSendRetry # 1.20.7 change to defined ... in sub _addSendqueueSimple
# 1.20.6 delete $hash->{OPMODE} in checkSendRetry
package FHEM::SynoModules::SMUtils; package FHEM::SynoModules::SMUtils;
@ -55,7 +56,7 @@ use FHEM::SynoModules::ErrCodes qw(:all); # Erro
use GPUtils qw( GP_Import GP_Export ); use GPUtils qw( GP_Import GP_Export );
use Carp qw(croak carp); use Carp qw(croak carp);
use version 0.77; our $VERSION = version->declare('1.25.0'); use version 0.77; our $VERSION = version->declare('1.26.0');
use Exporter ('import'); use Exporter ('import');
our @EXPORT_OK = qw( our @EXPORT_OK = qw(
@ -1709,12 +1710,14 @@ return;
# $text = zu übertragender Text # $text = zu übertragender Text
# $fileUrl = opt. zu übertragendes File # $fileUrl = opt. zu übertragendes File
# $channel = opt. Channel # $channel = opt. Channel
# $postid = opt. Post Id (zu löschen)
# #
###################################################################################### ######################################################################################
sub _addSendqueueExtended { sub _addSendqueueExtended {
my $paref = shift; my $paref = shift;
my $name = $paref->{name}; my $name = $paref->{name};
my $hash = $defs{$name}; my $hash = $defs{$name};
my $opmode = $paref->{opmode} // do {my $err = qq{internal ERROR -> opmode is empty}; Log3($name, 1, "$name - $err"); setReadingErrorState ($hash, $err); return}; my $opmode = $paref->{opmode} // do {my $err = qq{internal ERROR -> opmode is empty}; Log3($name, 1, "$name - $err"); setReadingErrorState ($hash, $err); return};
my $method = $paref->{method} // do {my $err = qq{internal ERROR -> method is empty}; Log3($name, 1, "$name - $err"); setReadingErrorState ($hash, $err); return}; my $method = $paref->{method} // do {my $err = qq{internal ERROR -> method is empty}; Log3($name, 1, "$name - $err"); setReadingErrorState ($hash, $err); return};
my $userid = $paref->{userid} // do {my $err = qq{internal ERROR -> userid is empty}; Log3($name, 1, "$name - $err"); setReadingErrorState ($hash, $err); return}; my $userid = $paref->{userid} // do {my $err = qq{internal ERROR -> userid is empty}; Log3($name, 1, "$name - $err"); setReadingErrorState ($hash, $err); return};
@ -1722,8 +1725,9 @@ sub _addSendqueueExtended {
my $fileUrl = $paref->{fileUrl}; my $fileUrl = $paref->{fileUrl};
my $channel = $paref->{channel}; my $channel = $paref->{channel};
my $attachment = $paref->{attachment}; my $attachment = $paref->{attachment};
my $postid = $paref->{postid};
if(!$text && $opmode !~ /chatUserlist|chatChannellist|apiInfo/x) { if(!$text && $opmode !~ /chatUserlist|chatChannellist|apiInfo|delPostId/x) {
my $err = qq{can't add message to queue: "text" is empty}; my $err = qq{can't add message to queue: "text" is empty};
Log3($name, 2, "$name - ERROR - $err"); Log3($name, 2, "$name - ERROR - $err");
@ -1739,7 +1743,8 @@ sub _addSendqueueExtended {
'channel' => $channel, 'channel' => $channel,
'text' => $text, 'text' => $text,
'attachment' => $attachment, 'attachment' => $attachment,
'fileUrl' => $fileUrl, 'fileUrl' => $fileUrl,
'postid' => $postid,
'retryCount' => 0 'retryCount' => 0
}; };
@ -1843,7 +1848,7 @@ sub checkSendRetry {
my $forbidSend = q{}; my $forbidSend = q{};
my $startfnref = \&{$startfn}; my $startfnref = \&{$startfn};
my @forbidlist = qw(100 101 103 117 120 400 401 407 408 409 410 414 418 419 420 800 900 my @forbidlist = qw(100 101 103 117 120 400 401 407 408 409 410 414 415 418 419 420 800 900
1000 1001 1002 1003 1004 1006 1007 1100 1101 1200 1300 1301 1400 1000 1001 1002 1003 1004 1006 1007 1100 1101 1200 1300 1301 1400
1401 1402 1403 1404 1405 1800 1801 1802 1803 1804 1805 2000 2001 1401 1402 1403 1404 1405 1800 1801 1802 1803 1804 1805 2000 2001
2002 9002); # bei diesen Errorcodes den Queueeintrag nicht wiederholen, da dauerhafter Fehler ! 2002 9002); # bei diesen Errorcodes den Queueeintrag nicht wiederholen, da dauerhafter Fehler !