From 489c44362f229ab1f86b21d544c24dc96e3e8cd8 Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Sun, 14 Dec 2014 14:03:38 +0000 Subject: [PATCH] FRITZBOX: New feature: set createPwdFile git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@7210 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/72_FRITZBOX.pm | 288 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 268 insertions(+), 20 deletions(-) diff --git a/FHEM/72_FRITZBOX.pm b/FHEM/72_FRITZBOX.pm index 74156e8a4..553def859 100644 --- a/FHEM/72_FRITZBOX.pm +++ b/FHEM/72_FRITZBOX.pm @@ -252,8 +252,9 @@ FRITZBOX_Set($$@) my $resultStr = ""; my $list = "alarm" - . " customerRingTone" . " convertRingTone" + . " createPwdFile" + . " customerRingTone" . " diversity" . " guestWlan:on,off" . " message" @@ -275,23 +276,32 @@ FRITZBOX_Set($$@) readingsSingleUpdate($hash,"alarm".$val[0]."_state",$val[1], 1); return undef; } - } - elsif ( lc $cmd eq 'convertringtone') - { + + } elsif ( lc $cmd eq 'convertringtone') { if (int @val > 0) { return FRITZBOX_ConvertRingTone $hash, @val; } - } - elsif ( lc $cmd eq 'customerringtone') - { + + } elsif ( lc $cmd eq 'createpwdfile') { + if (int @val > 0) + { + my $pwdFile = AttrVal( $name, "pwdFile", "fb_pwd.txt"); + open( FILE, ">".$pwdFile) + or return "Error when opening password file '$pwdFile': ".$!; + print FILE join( " ", @val); + close FILE + or return "Error when closing password file '$pwdFile': ".$!; + return "Created password file '$pwdFile'"; + } + + } elsif ( lc $cmd eq 'customerringtone') { if (int @val > 0) { return FRITZBOX_SetCustomerRingTone $hash, @val; } - } - elsif ( lc $cmd eq 'diversity') - { + + } elsif ( lc $cmd eq 'diversity') { if ( int @val == 2 && defined( $hash->{READINGS}{"diversity".$val[0]} ) && $val[1] =~ /^(on|off)$/ ) { my $state = $val[1]; @@ -301,9 +311,8 @@ FRITZBOX_Set($$@) readingsSingleUpdate($hash,"diversity".$val[0]."_state",$val[1], 1); return undef; } - } - elsif ( lc $cmd eq 'guestwlan') - { + + } elsif ( lc $cmd eq 'guestwlan') { if (int @val == 1 && $val[0] =~ /^(on|off)$/) { my $state = $val[0]; @@ -1538,22 +1547,26 @@ sub FRITZBOX_fritztris($)
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> convertRingTone <fullFilePath>
    - Converts the mp3-file fullFilePath to a G722 format and puts it in the same path. + Converts the mp3-file fullFilePath to the G722 format and puts it in the same path.
    - The file has to be placed on the file system of the fritzbox. + The file has to be placed on the file system of the Fritz!Box.

  • +
  • set <name> convertMusicOnHold <fullFilePath>
    Not implemented yet. Converts the mp3-file fullFilePath to a format that can be used for "Music on Hold".
    The file has to be placed on the file system of the fritzbox.

  • + +
  • set <name> createPwdFile <password> +
    + Creates a file that contains the telnet password. The file name corresponds to the one used for remote telnet access. +

  • +
  • set <name> customerRingTone <internalNumber> <fullFilePath>
    Uploads the file fullFilePath on the given handset. Only mp3 or G722 format is allowed. @@ -1562,6 +1575,7 @@ sub FRITZBOX_fritztris($)
    The upload takes about one minute before the tone is available.

  • +
  • set <name> diversity <number> <on|off>
    Switches the call diversity number (1, 2 ...) on or off. @@ -1569,6 +1583,12 @@ sub FRITZBOX_fritztris($)
    Note! The Fritz!Box allows also forwarding in accordance to the calling number. This is not included in this feature.

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

  • +
  • set <name> musicOnHold <fullFilePath>
    Not implemented yet. Uploads the file fullFilePath as "Music on Hold". Only mp3 or the MOH-format is allowed. @@ -1623,7 +1643,7 @@ sub FRITZBOX_fritztris($)
  • get <name> ringTones
    - Shows a list of ring tones that can be used. + Shows the list of ring tones that can be used.

  • @@ -1711,4 +1731,232 @@ sub FRITZBOX_fritztris($) =end html +=begin html_DE + + +

    FRITZBOX

    +
    +
      + Steuert gewisse Funktionen eines Fritz!Box Routers. Verbundene Fritz!Fon's (MT-F, MT-D, C3, C4) können als Signalgeräte genutzt werden. Das Modul schaltet in den lokalen Modus, wenn FHEM auf einer Fritz!Box läuft (als root-User!). +

      + Wenn FHEM nicht auf einer Fritz!Box läuft, versucht es eine Telnet Verbindung zu "fritz.box" zu öffnen. D.h. Telnet (#96*7*) muss auf der Fritz!Box erlaubt sein. Fü diesen Fernzugriff muss das Passwort in der Datei 'fb_pwd.txt' im Wurzelverzeichnis von FHEM gespeichert sein. +

      + Bitte auch die anderen Fritz!Box-Module beachten: SYSMON und FB_CALLMONITOR. +
      + Bisher wurde das Modul auf einer Fritz!Box 7390 und 7490 und auf den Fritz!Fon MT-F und C4 getestet. +
      + Das Modul nutzt das Perlmodule 'Net::Telnet' für den Fernzugriff. +

      + + Define +
        +
        + define <name> FRITZBOX +

        + Beispiel: define Fritzbox FRITZBOX +

        + Das Fritz!Box OS hat eine versteckte Funktion (Osterei). +
        + Teste sie mit: define MyEasterEgg weblink htmlCode { FRITZBOX_fritztris("Fritzbox") } +

        +
      + + + Set +
        +
        +
      • set <name> alarm <number> <on|off> +
        + Schaltet den Wecker Nummer 1, 2 oder 3 an oder aus. +

      • + +
      • set <name> convertRingTone <fullFilePath> +
        + Konvertiert die mp3-Datei fullFilePath in das G722-Format und legt es im selben Pfad ab. +
        + Die Datei muss im Dateisystem der Fritz!Box liegen. +

      • + +
      • set <name> convertMusicOnHold <fullFilePath> +
        + Not implemented yet. Converts the mp3-file fullFilePath to a format that can be used for "Music on Hold". +
        + The file has to be placed on the file system of the fritzbox. +

      • + +
      • set <name> createPwdFile <password> +
        + Erzeugt eine Datei welche das Telnet-Passwort enthält. Der Dateiname entspricht demjenigen, der für den Telnetzugriff genutzt wird. +

      • + +
      • set <name> customerRingTone <internalNumber> <fullFilePath> +
        + Lädt die Datei fullFilePath als Klingelton auf das angegebene Telefon. Nur das mp3- oder G722-Format ist erlaubt. +
        + Die Datei muss im Dateisystem der Fritzbox liegen. +
        + Das Hochladen dauert etwa eine Minute bis der Klingelton verfü,gbar ist. +

      • + +
      • set <name> diversity <number> <on|off> +
        + Schaltet die Rufumleitung (Nummer 1, 2 ...) an oder aus. + Die Rufumleitung muss zuvor auf der Fritz!Box eingerichtet werden. +
        + Achtung! Die Fritz!Box erm&oouml;glicht auch eine Weiterleitung in Abhängigkeit von der anrufenden Nummer. Diese Art der Weiterleitung kann hiermit nicht geschaltet werden. +

      • + +
      • set <name> guestWLAN <on|off> +
        + Schaltet das Gäste-WLAN an oder aus. +

      • + +
      • set <name> musicOnHold <fullFilePath> +
        + Not implemented yet. Uploads the file fullFilePath as "Music on Hold". Only mp3 or the MOH-format is allowed. +
        + The file has to be placed on the file system of the Fritz!Box. +
        + The upload takes about one minute before the tone is available. +

      • + +
      • set <name> ring <interneNummern> [Dauer [Klingelton]] [msg:Nachricht] + Beispiel: set fritzbox ring 611,612 5 Budapest msg:Es regnet +
        + Lässt die internen Nummern für "Dauer" Sekunden und (auf Fritz!Fons) mit dem angegebenen "Klingelton" klingeln. + Mehrere interne Nummern müssen durch ein Komma (ohne Leerzeichen) getrennt werden. +
        + Standard-Dauer ist 5 Sekunden. Standard-Klingelton ist der interne Klingelton des Gerätes. + Der Klingelton wird für Rundrufe (9 oder 50) ignoriert. +
        + Wenn das Attribute 'ringWithIntern' existiert, wird der Text hinter 'msg:' als Name des Anrufers angezeigt. + Er darf maximal 30 Zeichen lang sein. +
        + Wenn der Anruf angenommen wird, hört der Angerufene die Wartemusik (music on hold) welche zur Nachrichtenübermittlung genutzt werden kann. +

      • + +
      • set <name> sendMail [to:<Address>] [subject:<Subject>] [body:<Text>] +
        + Sendet eine Email über den Emailbenachrichtigungsservice der als Push Service auf der Fritz!Box konfiguriert wurde. + Alle Parameter können ausgelassen werden. Bitte kontrolliert, dass die Email nicht im Junk-Verzeichnis landet. +
        +

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

      • + +
      • set <name> tam <number> <on|off> +
        + Schaltet den Anrufbeantworter (Nummer 1, 2 ...) an oder aus. + Der Anrufbeantworter muss zuvor auf der Fritz!Box eingerichtet werden. +

      • + +
      • set <name> update +
        + Startet eine Aktualisierung der Gerätewerte. +

      • + +
      • set <name> wlan <on|off> +
        + Schaltet WLAN an oder aus. +

      • +
      + + + Get +
        +
        +
      • get <name> ringTones +
        + Zeigt die Liste der Klingeltöne, die benutzt werden können. +

      • +
      + + + Attributes +
        +
        +
      • defaultCallerName +
        + Standard-Text, der auf dem angerufenen internen Telefon als "Anrufer" gezeigt wird. +
        + Dies erfolgt, indem während des Klingelns kurzzeitige der Name der internen anrufenden Nummer geändert wird. +
        + Es ist maximal 30 Zeichen erlaubt. Das Attribute "ringWithIntern" muss ebenfalls spezifiziert sein. +

      • +
      • defaultUploadDir <fritzBoxPath> +
        + This is the default path that will be used if a file name does not start with / (slash). +
        + It needs to be the name of the path on the Fritz!Box. So, it should start with /var/InternerSpeicher if it equals in Windows \\ip-address\fritz.nas +

      • +
      • fritzBoxIP +
        + IP address or URL of the Fritz!Box for remote telnet access. Default is "fritz.box". +

      • +
      • pwdFile <fileName> +
        + File that contains the password for telnet access. Default is 'fb_pwd.txt' in the root directory of FHEM. +

      • +
      • telnetUser <user name> +
        + User name that is used for telnet access. By default no user name is required to login. +
        + If the Fritz!Box is configured differently, the user name has to be defined with this attribute. +

      • +
      • ringWithIntern <internalNumber> +
        + To ring a fon a caller must always be specified. Default of this modul is 50 "ISDN:Wählhilfe". +
        + To show a message (default: "FHEM") during a ring the internal phone numbers 1 or 2 can be specified here. +

      • +
      • readingFnAttributes
      • +
      +
      + + + Readings +

        +
      • alarm1 - Name of the alarm clock 1
      • +
      • alarm1_state - Current state of the alarm clock 1
      • +
      • alarm1_target - Internal number of the alarm clock 1
      • +
      • alarm1_time - Alarm time of the alarm clock 1
      • +
      • alarm1_wdays - Weekdays of the alarm clock 1
      • +
      • box_fwVersion - Firmware version of the box, if outdated then '(old)' is appended
      • +
      • box_guestWlan - Current state of the guest WLAN
      • +
      • box_model - Fritz!Box model
      • +
      • box_wlan_2.4GHz - Current state of the 2.4 GHz WLAN
      • +
      • box_wlan_5GHz - Current state of the 5 GHz WLAN
      • +
      • dect1 - Name of the DECT device 1
      • +
      • dect1_alarmRingTone - Alarm ring tone of the DECT device 1
      • +
      • dect1_custRingTone - Customer ring tone of the DECT device 1
      • +
      • dect1_fwVersion - Firmware Version of the DECT device 1
      • +
      • dect1_intern - Internal number of the DECT device 1
      • +
      • dect1_intRingTone - Internal ring tone of the DECT device 1
      • +
      • dect1_manufacturer - Manufacturer of the DECT device 1
      • +
      • dect1_model - Model of the DECT device 1
      • +
      • dect1 - Internal name of the analog FON connection 1
      • +
      • dect1_intern - Internal number of the analog FON connection 1
      • +
      • diversity1 - Incoming phone number of the call diversity 1
      • +
      • diversity1_dest - Destination of the call diversity 1
      • +
      • diversity1_state - Current state of the call diversity 1
      • +
      • radio01 - Name of the internet radio station 01
      • +
      • tam1 - Name of the answering machine 1
      • +
      • tam1_newMsg - New messages on the answering machine 1
      • +
      • tam1_oldMsg - Old messages on the answering machine 1
      • +
      • tam1_state - Current state of the answering machine 1
      • +
      • user01 - Name of user/IP 1 that is under parental control
      • +
      • user01_thisMonthTime - this month internet usage of user/IP 1 (parental control)
      • +
      • user01_todaySeconds - today's internet usage in seconds of user/IP 1 (parental control)
      • +
      • user01_todayTime - today's internet usage of user/IP 1 (parental control)
      • +
      +
      +
    +
    + +=end html_DE + =cut- \ No newline at end of file