diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index daa516930..1c142be51 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -221,6 +221,7 @@ FRITZBOX_Set($$@) . " message" . " ring" . " startRadio" + . " tam" . " update:noArg" . " wlan:on,off"; @@ -293,6 +294,18 @@ FRITZBOX_Set($$@) return undef; } } + elsif ( lc $cmd eq 'tam') + { + if ( int @val == 2 && defined( $hash->{READINGS}{"tam".$val[0]} ) && $val[1] =~ /^(on|off)$/ ) + { + my $state = $val[1]; + $state =~ s/on/1/; + $state =~ s/off/0/; + FRITZBOX_Exec( $hash, "ctlmgr_ctl w tam settings/TAM".( $val[0] - 1 )."/Active ".$state ); + readingsSingleUpdate($hash,"tam".$val[0]."_state",$val[1], 1); + return undef; + } + } elsif ( lc $cmd eq 'wlan') { if (int @val == 1 && $val[0] =~ /^(on|off)$/) @@ -392,12 +405,13 @@ FRITZBOX_Readout_Run($) { # Init and Counters - push @readoutArray, ["", "ctlmgr_ctl r telcfg settings/Foncontrol"]; - push @readoutArray, ["", "ctlmgr_ctl r telcfg settings/Foncontrol/User/count"]; - push @readoutArray, ["", "ctlmgr_ctl r configd settings/WEBRADIO/count"]; - push @readoutArray, ["", "ctlmgr_ctl r user settings/user/count"]; + push @readoutArray, ["", "ctlmgr_ctl r telcfg settings/Foncontrol" ]; + push @readoutArray, ["", "ctlmgr_ctl r telcfg settings/Foncontrol/User/count" ]; + push @readoutArray, ["", "ctlmgr_ctl r configd settings/WEBRADIO/count" ]; + push @readoutArray, ["", "ctlmgr_ctl r user settings/user/count" ]; push @readoutArray, ["", 'echo $CONFIG_AB_COUNT']; - push @readoutArray, ["", "ctlmgr_ctl r landevice settings/landevice/count"]; + push @readoutArray, ["", "ctlmgr_ctl r landevice settings/landevice/count" ]; + push @readoutArray, ["", "ctlmgr_ctl r tam settings/TAM/count" ]; # Box model and firmware push @readoutArray, [ "box_model", 'echo $CONFIG_PRODUKT', "nounderline" ]; @@ -409,6 +423,7 @@ FRITZBOX_Readout_Run($) my $userCount = $resultArray->[3]; my $fonCount = $resultArray->[4]; my $lanDeviceCount = $resultArray->[5]; + my $tamCount = $resultArray->[6]; # Internetradioliste erzeugen @@ -419,7 +434,7 @@ FRITZBOX_Readout_Run($) $rName = "radio00"; do { - push @readoutArray, [ $rName, "ctlmgr_ctl r configd settings/WEBRADIO".$i."/Name"]; + push @readoutArray, [ $rName, "ctlmgr_ctl r configd settings/WEBRADIO".$i."/Name" ]; $i++; $rName = sprintf ("radio%02d",$i); } @@ -440,8 +455,8 @@ FRITZBOX_Readout_Run($) { for (0..$lanDeviceCount-1) { - push @readoutArray, [ "", "ctlmgr_ctl r landevice settings/landevice".$_."/ip"]; - push @readoutArray, [ "", "ctlmgr_ctl r landevice settings/landevice".$_."/name"]; + push @readoutArray, [ "", "ctlmgr_ctl r landevice settings/landevice".$_."/ip" ]; + push @readoutArray, [ "", "ctlmgr_ctl r landevice settings/landevice".$_."/name" ]; } $resultArray = FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings ); @@ -503,7 +518,7 @@ FRITZBOX_Readout_Run($) # Analog Fons Name foreach (1..$fonCount) { - push @readoutArray, ["fon".$_, "ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/Name"]; + push @readoutArray, ["fon".$_, "ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/Name" ]; } $resultArray = FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings ); @@ -514,15 +529,39 @@ FRITZBOX_Readout_Run($) if $resultArray->[$_-1]; } - # user profiles + # Anrufbeantworter (TAM) + if ($tamCount > 0 ) + { + # Check if TAM is displayed + for (0..$tamCount-1) + { + push @readoutArray, [ "", "ctlmgr_ctl r tam settings/TAM".$_."/Display" ]; + } + $resultArray = FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings ); + #Get TAM readings + for (0..$tamCount-1) + { + $rName = "tam".($_+1); + if ( $resultArray->[$_] == 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" ]; + push @readoutArray, [ $rName."_newMsg", "ctlmgr_ctl r tam settings/TAM".$_."/NumNewMessages" ]; + push @readoutArray, [ $rName."_oldMsg", "ctlmgr_ctl r tam settings/TAM".$_."/NumOldMessages" ]; + } + } + FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings ); + } + +# user profiles $i=0; $rName = "user01"; do { - push @readoutArray, [$rName, "ctlmgr_ctl r user settings/user".$i."/name", "deviceip"]; - push @readoutArray, [$rName."_thisMonthTime", "ctlmgr_ctl r user settings/user".$i."/this_month_time", "timeinhours"]; - push @readoutArray, [$rName."_todayTime", "ctlmgr_ctl r user settings/user".$i."/today_time", "timeinhours"]; - push @readoutArray, [$rName."_type", "ctlmgr_ctl r user settings/user".$i."/type"]; + push @readoutArray, [$rName, "ctlmgr_ctl r user settings/user".$i."/name", "deviceip" ]; + push @readoutArray, [$rName."_thisMonthTime", "ctlmgr_ctl r user settings/user".$i."/this_month_time", "timeinhours" ]; + push @readoutArray, [$rName."_todayTime", "ctlmgr_ctl r user settings/user".$i."/today_time", "timeinhours" ]; + push @readoutArray, [$rName."_type", "ctlmgr_ctl r user settings/user".$i."/type" ]; $i++; $rName = sprintf ("user%02d",$i+1); } @@ -538,15 +577,15 @@ FRITZBOX_Readout_Run($) foreach (0..2) { # Alarm clock name - push @readoutArray, ["alarm".($_+1), "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Name"]; + push @readoutArray, ["alarm".($_+1), "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Name" ]; # Alarm clock state - push @readoutArray, ["alarm".($_+1)."_state", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Active", "onoff"]; + push @readoutArray, ["alarm".($_+1)."_state", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Active", "onoff" ]; # Alarm clock time - push @readoutArray, ["alarm".($_+1)."_time", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Time", "altime"]; + push @readoutArray, ["alarm".($_+1)."_time", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Time", "altime" ]; # Alarm clock number - push @readoutArray, ["alarm".($_+1)."_target", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Number", "alnumber"]; + push @readoutArray, ["alarm".($_+1)."_target", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Number", "alnumber" ]; # Alarm clock weekdays - push @readoutArray, ["alarm".($_+1)."_wdays", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Weekdays", "aldays"]; + push @readoutArray, ["alarm".($_+1)."_wdays", "ctlmgr_ctl r telcfg settings/AlarmClock".$_."/Weekdays", "aldays" ]; } $resultArray = FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings ); @@ -1011,7 +1050,8 @@ FRITZBOX_Exec($$) { if ( int (@{$cmd}) > 0 ) { - FRITZBOX_Log $hash, 5, "Execute " . int ( @{$cmd} ) . " command(s): '" . join( " | ", @{$cmd} ) . "'"; + FRITZBOX_Log $hash, 4, "Execute " . int ( @{$cmd} ) . " command(s)"; + FRITZBOX_Log $hash, 5, "Commands: '" . join( " | ", @{$cmd} ) . "'"; my $cmdStr = join "\necho ' |#|'\n", @{$cmd}; $cmdStr .= "\necho ' |#|'"; my $result = qx($cmdStr); @@ -1022,7 +1062,8 @@ FRITZBOX_Exec($$) $resultArray[$_] =~ s/\s$//; } @{$cmd} = (); - FRITZBOX_Log $hash, 5, "Received ".int(@resultArray)." answer(s): '".join (" | ", @resultArray)."'"; + FRITZBOX_Log $hash, 4, "Received ".int(@resultArray)." answer(s)"; + FRITZBOX_Log $hash, 5, "Result: '" . join (" | ", @resultArray)."'"; return \@resultArray; } else @@ -1051,6 +1092,8 @@ FRITZBOX_Exec($$) Note!! To use it, FHEM has to run on a Fritz!Box.
So fare, the module has been tested on Fritz!Box 7390 and Fritz!Fon MT-F only. +
+ Check also the other Fritz!Box moduls: SYSMON and FB_CALLMONITOR.

Define @@ -1068,27 +1111,12 @@ FRITZBOX_Exec($$)
  • set <name> alarm <number> <on|off>
    - Switches the alarm number (1, 2 or 3 on or off. + Switches the alarm number (1, 2 or 3) on or off.

  • set <name> guestWLAN <on|off>
    Switches the guest WLAN on or off.

  • -
  • set <name> update -
    - Starts an update of the device readings. -

  • -
  • set <name> ring <internalNumber> [duration [ringTone]] [msg:yourMessage] - Example: set fritzbox ring 612 5 Budapest msg:It is raining -
    - Rings the internal number for "duration" seconds with the given "ring tone" name. -
    - The text behind 'msg:' will be shown as the callers name. - Maximal 30 characters are allowed. - The attribute "ringWithIntern" must also be specified. -
    - Default duration is 5 seconds. Default ring tone is the internal ring tone of the device. -

  • set <name> convertRingTone <fullFilePath>
    Converts the mp3-file fullFilePath to a G722 format and puts it in the same path. @@ -1103,11 +1131,30 @@ FRITZBOX_Exec($$)
    The upload takes about one minute before the tone is available.

  • +
  • set <name> ring <internalNumber> [duration [ringTone]] [msg:yourMessage] + Example: set fritzbox ring 612 5 Budapest msg:It is raining +
    + Rings the internal number for "duration" seconds with the given "ring tone" name. +
    + The text behind 'msg:' will be shown as the callers name. + Maximal 30 characters are allowed. + The attribute "ringWithIntern" must also be specified. +
    + Default duration is 5 seconds. Default ring tone is the internal ring tone of the device. +

  • set <name> startradio <internalNumber> [name]
    not implemented yet. Starts the internet radio on the given Fritz!Fon

  • +
  • set <name> tam <number> <on|off> +
    + Switches the answering machine number (1-10) on or off. +

  • +
  • set <name> update +
    + Starts an update of the device readings. +

  • set <name> wlan <on|off>
    Switches WLAN on or off. @@ -1155,15 +1202,16 @@ FRITZBOX_Exec($$) Readings