diff --git a/fhem/CHANGED b/fhem/CHANGED index 2bb1bbd66..add7e467b 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - change: 50_Signalbot: Minor change in event behavior and catch dbus error - change: 74_AutomowerConnect: Common.pm, automowerconnect.js shift subs to library, mowing path: display only way point dots alternatively diff --git a/fhem/FHEM/50_Signalbot.pm b/fhem/FHEM/50_Signalbot.pm index 9bd81b026..669b3fa41 100755 --- a/fhem/FHEM/50_Signalbot.pm +++ b/fhem/FHEM/50_Signalbot.pm @@ -1,6 +1,6 @@ ############################################## #$Id$ -my $Signalbot_VERSION="3.12"; +my $Signalbot_VERSION="3.13"; # Simple Interface to Signal CLI running as Dbus service # Author: Adimarantis # License: GPL @@ -220,7 +220,7 @@ sub Signalbot_Set($@) { # my @cm=split(",",$args[0]); $cmd=$cmd.$cm[0]; $args[0]=$cm[1]; - print "$cmd ".join(":",@args)."\n"; + LogUnicode $hash->{NAME}, 3, $hash->{NAME}.": $cmd ".join(":",@args); } if ( $cmd eq "signalAccount" ) { @@ -364,7 +364,9 @@ sub Signalbot_Set($@) { # my $number=Signalbot_translateContact($hash,$nickname); return "Unknown contact" if !defined $number; delete $hash->{helper}{contacts}{$number} if defined $hash->{helper}{contacts}{$number}; + Signalbot_CallA($hash,"deleteContact",$number); Signalbot_CallA($hash,"deleteRecipient",$number); + delete $hash->{helper}{contacts}{$number}; return; } elsif ( $cmd eq "deleteGroup" || $cmd eq "groupdelete") { return "Usage: set ".$hash->{NAME}." deleteGroup " if (@args<1); @@ -1052,7 +1054,7 @@ sub Signalbot_ReceiptReceived { readingsBeginUpdate($hash); readingsBulkUpdate($hash, "sentMsgRecipient", $sender); readingsBulkUpdate($hash, 'sentMsgTimestamp', strftime("%d-%m-%Y %H:%M:%S", localtime($timestamp/1000))); - readingsEndUpdate($hash, 0); + readingsEndUpdate($hash, 1); } sub Signalbot_SyncMessageReceived { @@ -1151,7 +1153,7 @@ sub Signalbot_setup2($@) { } my $version=Signalbot_CallS($hash,"version"); my $account=ReadingsVal($name,"account","none"); - if (!defined $version) { + if (!defined $version || ($version =~ /\d+\.\d+\.\d+/) == 0){ if ($Signalbot_Retry<3) { $Signalbot_Retry++; InternalTimer(gettimeofday() + 10, 'Signalbot_setup', $hash, 0); @@ -1423,7 +1425,12 @@ sub Signalbot_Read($@){ my $counter=5; while (defined $msg || $counter>0) { $dbus->blocking(0); - $msg = $dbus->get_message(); + $msg = eval{$dbus->get_message()}; + if ($@) { + # This is fatal reinitialize + Signalbot_setup($hash); + return; + } if ($msg) { #Signal handling my $callback = $msg->get_header('MEMBER'); @@ -1676,7 +1683,7 @@ sub Signalbot_sendMessage($@) { readingsBeginUpdate($hash); readingsBulkUpdate($hash, "sentMsg", $mes); readingsBulkUpdate($hash, 'sentMsgTimestamp', "pending"); - readingsEndUpdate($hash, 0); + readingsEndUpdate($hash, 1); Signalbot_CallA($hash,"sendMessage",$mes,\@attach,\@recipient); } @@ -1715,7 +1722,7 @@ sub Signalbot_sendGroupMessage($@) { readingsBeginUpdate($hash); readingsBulkUpdate($hash, "sentMsg", $mes); readingsBulkUpdate($hash, 'sentMsgTimestamp', "pending"); - readingsEndUpdate($hash, 0); + readingsEndUpdate($hash, 1); Signalbot_CallA($hash,"sendGroupMessage",$mes,\@attach,\@arr); } @@ -2002,6 +2009,11 @@ sub Signalbot_Detail { if (defined $DBus_missing) { return "Perl module Protocol:DBus not found, please install with
sudo cpan install Protocol::DBus
and restart FHEM

"; } + + if (ReadingsVal($name,"state",0) eq "unavailable") { + return "Dbus could not be initialized, please validate your Linux installation

"; + } + my $multi=$hash->{helper}{multi}; my $version=$hash->{helper}{version}; $multi=0 if !defined $multi; @@ -2014,7 +2026,7 @@ sub Signalbot_Detail { $ret .= "Signal-cli is running in single-mode, please consider starting it without -u parameter (e.g. by re-running the installer)
"; } if($version<1100 || $multi==0) { - $ret .= '
You can download the installer here or your www/signal directory and run it with
sudo ./signal_install.sh

'; + $ret .= '
You can download the installer here or your www/signal directory and run it with
sudo ./signal_install.sh

'; } return $ret if ($hash->{helper}{version}<1100);