From 5fb77f40ed760cafa84a8262d7e06cc7c20695fe Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Thu, 1 Jan 2015 21:31:08 +0000 Subject: [PATCH] FRITZBOX: radioStation 39: fhemTTS git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@7399 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/72_FRITZBOX.pm | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/FHEM/72_FRITZBOX.pm b/FHEM/72_FRITZBOX.pm index cf4e626c4..a11e0ee5f 100644 --- a/FHEM/72_FRITZBOX.pm +++ b/FHEM/72_FRITZBOX.pm @@ -1054,7 +1054,7 @@ FRITZBOX_Ring_Run($) my %field; my $lastField; my $ttsLink; - my $fhemRadioStation; + my $fhemRadioStation = 39; # Check if 1st parameter are comma separated numbers return $name."|0|Error: Parameter '$intNo' not a number (only commas (,) are allowed to separate numbers)" @@ -1144,24 +1144,11 @@ FRITZBOX_Ring_Run($) @cmdArray = (); # Creation fhemRadioStation for ttsLink - if (int (@FritzFons) && $ttsLink) + if (int (@FritzFons) && $ttsLink && $hash->{fhem}{radio}{$fhemRadioStation} ne "fhemTTS") { - foreach (keys %{$hash->{fhem}{radio}}) - { - if ($hash->{fhem}{radio}{$_} eq "fhemTTS") - { - $fhemRadioStation = $_; - last; - } - } - unless (defined $fhemRadioStation) - { - FRITZBOX_Log $hash, 3, "Create new internet radio station 'fhemTTS' for ringing with text-to-speech"; - $fhemRadioStation = int( keys %{$hash->{fhem}{radio}}); - push @cmdArray, "ctlmgr_ctl w configd settings/WEBRADIO".$fhemRadioStation."/Name fhemTTS"; - push @cmdArray, "ctlmgr_ctl w configd settings/WEBRADIO".$fhemRadioStation."/Bitmap 1023"; - } - push @cmdArray, 'ctlmgr_ctl w configd settings/WEBRADIO'.$fhemRadioStation.'/URL "'.$ttsLink.'"'; + FRITZBOX_Log $hash, 3, "Create new internet radio station $fhemRadioStation: 'fhemTTS' for ringing with text-to-speech"; + push @cmdArray, "ctlmgr_ctl w configd settings/WEBRADIO39/Name fhemTTS"; + push @cmdArray, "ctlmgr_ctl w configd settings/WEBRADIO39/Bitmap 1023"; #Execute command array FRITZBOX_Exec( $hash, \@cmdArray ) } @@ -1172,11 +1159,11 @@ FRITZBOX_Ring_Run($) push @cmdArray, "ctlmgr_ctl r telcfg settings/Foncontrol/User$_/IntRingTone"; push @cmdArray, "ctlmgr_ctl w telcfg settings/Foncontrol/User$_/IntRingTone $ringTone"; FRITZBOX_Log $hash, 4, "Change temporarily internal ring tone of Fritz!Fon DECT $_ to $ringTone"; - if ($fhemRadioStation) + if ($ttsLink) { push @cmdArray, "ctlmgr_ctl r telcfg settings/Foncontrol/User$_/RadioRingID"; - push @cmdArray, "ctlmgr_ctl w telcfg settings/Foncontrol/User$_/RadioRingID $fhemRadioStation"; - FRITZBOX_Log $hash, 4, "Change radio station of Fritz!Fon DECT $_ to $fhemRadioStation"; + push @cmdArray, "ctlmgr_ctl w telcfg settings/Foncontrol/User$_/RadioRingID ".$fhemRadioStation; + FRITZBOX_Log $hash, 4, "Change radio station of Fritz!Fon DECT $_ to $fhemRadioStation (fhemTTS)"; } } @@ -1189,6 +1176,10 @@ FRITZBOX_Ring_Run($) FRITZBOX_Log $hash, 4, "Change temporarily name of calling number $ringWithIntern to '$msg'"; push @cmdArray, "ctlmgr_ctl w telcfg settings/DialPort $ringWithIntern" } + +# Set tts-Message + push @cmdArray, 'ctlmgr_ctl w configd settings/WEBRADIO'.$fhemRadioStation.'/URL "'.$ttsLink.'"' + if $ttsLink; #Execute command array $result = FRITZBOX_Exec( $hash, \@cmdArray ) @@ -1208,7 +1199,7 @@ FRITZBOX_Ring_Run($) { push @cmdArray, "ctlmgr_ctl w telcfg settings/Foncontrol/User".$FritzFons[$_]."/IntRingTone ".$result->[2*$_]; # Reset internet station for the Fritz!Fons - if ($fhemRadioStation) + if ($ttsLink) { push @cmdArray, "ctlmgr_ctl w telcfg settings/Foncontrol/User".$FritzFons[$_]."/RadioRingID ".$result->[2*(int(@FritzFons)+$_)]; } @@ -1217,7 +1208,7 @@ FRITZBOX_Ring_Run($) # Reset name of calling number if ($ringWithIntern =~ /^([1-2])$/) { - if ($fhemRadioStation) { + if ($ttsLink) { push @cmdArray, "ctlmgr_ctl w telcfg settings/MSN/Port".($ringWithIntern-1)."/Name '".$result->[4*int(@FritzFons)]."'" } else { push @cmdArray, "ctlmgr_ctl w telcfg settings/MSN/Port".($ringWithIntern-1)."/Name '".$result->[2*int(@FritzFons)]."'" @@ -1912,7 +1903,7 @@ sub FRITZBOX_fritztris($)