After some research it became obvious that more manual work is required, hence again something which can be automated.
openHAB has 3 different modules available which support the AVM FRITZ!Box:
AVM FRITZ! Binding: This only supports the home automation on the FRITZ!Box, no information about calls or the box itself is available. Not sure if that will be added to this binding at some point. That is also the only extension which is native for 2.0.
Fritz!Box Binding: That’s an old and legacy 1.0 binding which requires telnet access to the FRITZ!Box. Since the telnet support is disabled since FRITZ!OS 6, this extension is more or less useless these days.
For my purpose I need the fritzboxtr0641 binding in order to receive status and call information. Given that it’s a legacy binding, first the legacy bindings need to be activated:
- name:Get list of available and installed extensionsuri:url:"http://{{ ansible_host }}:8080/rest/extensions"register:oh2_extensionschanged_when:false- name:Install extensionsuri:url:"http://{{ ansible_host }}:8080/rest/extensions/{{ item }}/install"method:POSTwhen:"not (oh2_extensions.json|byattr('id', item))[0].installed"with_items:- binding-fritzboxtr0641register:oh2_install_extensions
This extension installs a configuration file, which mainly contains connection information for the FRITZ!Box: IP, username, password. It is strongly recommended to create a separate account on the FRITZ!Box.
The call monitor on the FRITZ!Box is disabled by default. Without this monitor enabled, all the callmonitor_* Items will not work. Unfortunately the plugin will not log any useful information, but rather just log a connection refused, a Java stack trace, and will keep trying with an increasing timeout.
To enable the call monitor, call #96*5* from any connected DECT telephone. And #96*4* turns the call monitor off again.
Now it’s time to add the available Items. That must happen in an .items file, because legacy extensions can’t be configured using the web UI. A good place is /etc/openhab2/items/fritzboxtr0641.items:
String fboxName "FBox Model [%s]"{fritzboxtr064="modelName"}// get wan ip if FritzBox establishes the internet connection (e. g. via DSL)
String fboxWanIP "FBox WAN IP [%s]"{fritzboxtr064="wanip"}// get wan ip if FritzBox uses internet connection of external router
//String fboxWanIPExternal "FBox external WAN IP [%s]" {fritzboxtr064="externalWanip"}
// only when using call monitor
// #96*5* - enable callmonitor
// #96*4* - disable callmonitor
Switch fboxRinging "Phone ringing [%s]"{fritzboxtr064="callmonitor_ringing"}
Switch fboxRinging_Out "Phone ringing [%s]"{fritzboxtr064="callmonitor_outgoing"}
Call fboxIncomingCall "Incoming call: [%1$s to %2$s]"{fritzboxtr064="callmonitor_ringing"}
Call fboxOutgoingCall "Outgoing call: [%1$s to %2$s]"{fritzboxtr064="callmonitor_outgoing"}// resolve numbers to names according phonebook
Call fboxIncomingCallResolved "Incoming call: [%1$s to %2$s]"{fritzboxtr064="callmonitor_ringing:resolveName"}//// Telephone answering machine (TAM) items
//// Number after tamSwitch is ID of configured TAM, start with 0
Switch fboxTAM0Switch "Answering machine ID 0"{fritzboxtr064="tamSwitch:0"}
Number fboxTAM0NewMsg "New Messages TAM 0 [%s]"{fritzboxtr064="tamNewMessages:0"}// Missed calls: specify the number of last days which should be searched for missed calls
Number fboxMissedCalls "Missed Calls [%s]"{fritzboxtr064="missedCallsInDays:5"}
Obviously I don’t edit the file on the openHAB server, but locally and copy it to the server: