diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm
index 38a2770f9..f0a13dd8d 100644
--- a/fhem/FHEM/72_FRITZBOX.pm
+++ b/fhem/FHEM/72_FRITZBOX.pm
@@ -608,7 +608,7 @@ FRITZBOX_Readout_Run($)
# 5 Radio Name
push @readoutArray, [ "dect".$_."_radio", "ctlmgr_ctl r telcfg settings/Foncontrol/User".$_."/RadioRingID", "radio" ];
# 6 Background image
- push @readoutArray, [ "dect".$_."_imagePath ", "ctlmgr_ctl r telcfg settings/Foncontrol/User".$_."/ImagePath " ];
+ push @readoutArray, [ "dect".$_."_imagePath", "ctlmgr_ctl r telcfg settings/Foncontrol/User".$_."/ImagePath" ];
# 7 Customer Ring Tone
push @readoutArray, [ "dect".$_."_custRingTone", "ctlmgr_ctl r telcfg settings/Foncontrol/User".$_."/G722RingTone" ];
# 8 Customer Ring Tone Name
@@ -666,7 +666,7 @@ FRITZBOX_Readout_Run($)
for (0..$tamCount-1)
{
$rName = "tam".($_+1);
- if ($resultArray->[$_] == 1 || defined $hash->{READINGS}{$rName} )
+ if ($resultArray->[$_] eq "1" || defined $hash->{READINGS}{$rName} )
{
push @readoutArray, [ $rName, "ctlmgr_ctl r tam settings/TAM". $_ ."/Name" ];
push @readoutArray, [ $rName."_state", "ctlmgr_ctl r tam settings/TAM".$_."/Active", "onoff" ];
@@ -890,9 +890,9 @@ sub FRITZBOX_Readout_Format($$$)
unless $readout ne "" && $format ne "" ;
if ($format eq "aldays") {
- if ($readout == 0) {
+ if ($readout eq "0") {
$readout = "once";
- } elsif ($readout == 127) {
+ } elsif ($readout eq "127") {
$readout = "daily";
} else {
my $bitStr = $readout;
@@ -1090,7 +1090,7 @@ FRITZBOX_Ring_Run($)
$intNo =~ s/,/#/g;
#Preparing 2nd command array to ring and reset everything
- FRITZBOX_Log $hash, 3, "Ringing $intNo for $duration seconds";
+ FRITZBOX_Log $hash, 4, "Ringing $intNo for $duration seconds";
push @cmdArray, "ctlmgr_ctl w telcfg command/Dial **".$intNo;
push @cmdArray, "ctlmgr_ctl w telcfg settings/DialPort 50"
if $ringWithIntern != 0 ;
@@ -1099,11 +1099,11 @@ FRITZBOX_Ring_Run($)
{
push @cmdArray, "ctlmgr_ctl w telcfg settings/Foncontrol/User".$FritzFons[$_]."/IntRingTone ".$result->[2*$_];
}
+ push @cmdArray, "sleep ".$duration;
# Reset name of calling number
push @cmdArray, "ctlmgr_ctl w telcfg settings/MSN/Port".($ringWithIntern-1)."/Name '".$result->[2*int(@FritzFons)]."'"
if $ringWithIntern =~ /^([1-4])$/;
- push @cmdArray, "sleep ".$duration;
push @cmdArray, "ctlmgr_ctl w telcfg command/Hangup **".$intNo;
# Execute command array
@@ -1222,7 +1222,7 @@ sub FRITZBOX_SetMOH($@)
# Execute command array
$result = FRITZBOX_Exec ( $hash, \@cmdArray );
return "Could not access '$inFile'"
- unless $result->[3] == 1;
+ unless $result->[3] eq "1";
#Prepare 2nd command array
push @cmdArray, 'ffmpegconv -i "'.$uploadFile.'" -o "'.$mohFile.'" --limit 32 --type 7';
@@ -1230,7 +1230,7 @@ sub FRITZBOX_SetMOH($@)
# Execute 2nd command array
$result = FRITZBOX_Exec ( $hash, \@cmdArray );
return "Could not convert '$inFile'"
- unless $result->[1] == 1;
+ unless $result->[1] eq "1";
#Prepare 3rd command array
push @cmdArray, 'cat "'.$mohFile.'" >/var/flash/fx_moh';
@@ -1642,16 +1642,21 @@ sub FRITZBOX_Send_Mail($@)
my $cmd = "/sbin/mailer send";
if ($field{body})
{
- push @cmdArray, "/bin/echo \"".$field{body}."\" > /var/tmp/fhem_nachricht.txt";
+ chop $field{body};
+ $field{body} =~ s/"/\\"/g;
+ push @cmdArray, '/bin/echo -e "'.$field{body}.'" >/var/tmp/fhem_nachricht.txt';
$cmd .= " -i '/var/tmp/fhem_nachricht.txt'";
}
- $field{subject} = "Message from FHEM"
- unless $field{subject};
+ chop $field{subject} if $field{subject};
+ $field{subject} = "Message from FHEM " unless $field{subject};
$cmd .= " -s \"".$field{subject}."\"";
- $cmd .= " -t \"".$field{to}."\""
- if $field{to} ne "";
+ if ($field{to})
+ {
+ chop $field{to};
+ $cmd .= " -t \"".$field{to}."\""
+ }
push @cmdArray, $cmd;
push @cmdArray, "rm /var/tmp/fhem_nachricht.txt"
if $field{body};
@@ -1788,9 +1793,9 @@ sub FRITZBOX_fritztris($)
The modul switches in local mode if FHEM runs on a Fritz!Box (as root user!). Otherwise, it tries to open a telnet connection to "fritz.box", so telnet (#96*7*) has to be enabled on the Fritz!Box. For remote access the password must be stored in the file 'fb_pwd.txt' in the root directory of FHEM.
- Check also the other Fritz!Box moduls: SYSMON and FB_CALLMONITOR.
+ The commands are directly executed on the Fritz!Box shell. That means, no official API is used but mainly the internal interface program that links web interface and firmware. On update of FritzOS might hence lead to modul errors if AVM changes the interface.
- So fare, the module has been tested on Fritz!Box 7390 and 7490 and Fritz!Fon MT-F and C4.
+ Check also the other Fritz!Box moduls: SYSMON and FB_CALLMONITOR.
The modul uses the Perl modul 'Net::Telnet' for remote access.
@@ -1886,7 +1891,8 @@ sub FRITZBOX_fritztris($)
set <name> sendMail [to:<Address>] [subject:<Subject>] [body:<Text>]
set <name> sendMail [to:<Address>] [subject:<Subject>] [body:<Text>]