Make DECT phones (e.g.) FritzFons connected to FritzBox ring as alerting mechanism from OpenHab (should be useful also to have OpenHab make arbitrary phone calls with alerts/announcements)

Having just installed my first ShellyFlood, I wanted to get OpenHab to get an alert out via our local DECT phone setup (which we also use as doorbell substitute via the FritzBox builtin capabilities, so we have DECT phones within hearing distance in the entire house), I could not find an immediate up-to-date solution online.
So here I’ll attempt to sketch out my provisional workaround, which appears to work OK for now, long term experience pending, and

  • relies only on software that seems to be actively maintained currently,
  • is available prepackaged on openhabian for Raspi
  • and has no cloud dependency, i.e. runs completely on premise.

Checking out the various previously described options I found did not bring up anything fulfilling these criteria. I guess the natural way to approach this would be to have the TR064 binding with its FritzBox extension support the relevant TR064 features of the FB (if this were sufficient, couldn’t figure this out easily from the online docs, plus this would mean modifying the binding, it would appear => too much work for an afternoon).

What seems to work provisionally from the openhabian environment is using the linphone client; OpenHab can make internal “to all” as well as external calls and play a WAV audio file if anyone picks up.

Steps to achieve this:

  • install linphone on your OpenHab raspi via apt-get install linphone, which will install a bunch of other dependencies (say yes to respective question by apt-get)
  • set up a new VOIP phone (device type “LAN/WLAN”) on your FritzBox, with a name that’ll carry the relevant message when displayed on the phones, e.g. “Flood Alarm Basement” and make note of the authentication data (USERNAME, PASSWORD)
  • set up a bash script (create file in editor named e.g., do ‘chmod +x’ to make executable) similar to this one

    linphonecsh init
    sleep 1
    linphonecsh register --host --username USERNAME --password PASSWORD
    linphonecsh dial “sip:**”
    sleep 10
    linphonecsh hangup
    linphonecsh exit
  • the first sleep seems necessary to give the linphone daemon time to get ready (would of course be better to run the linphone daemon as an actual daemon, see ToDos below), the second determines for how long the phones will ring
  • the effect is that all DECT phones will ring with the internal ring tone (for now) and display “Flood Alarm Basement”, or whatever you named the LAN/WLAN phone you created in the FritzBox setup
  • set up rule to trigger this, e.g., using rules DSL var execResult = executeCommandLine(Duration.ofSeconds(60), "/etc/openhab/shellscripts/") (usually like to use ECMA script, haven’t figured out how to get executeCommandLine to work from there, suggestions most welcome…)

If you want to play audio (in this case, the file ‘test.wav’) if someone picks up the call, you can add

linphonecsh generic ‘soundcard use files’
linphonecsh generic ‘play /etc/openhab/ressources/test.wav’

before the dial command in the above bash file. The WAV has to be 16 bit linear. In my setup, linphone will loop this file until the call is terminated, which seems suitable for alerting purposes.

Note: one can also use this same mechanims to dial out to arbitrary phones including mobiles if desired (and you have your LAN/WLAN phone in the FritzBox configured to permit this). Be careful with phone charges, though, if you don’t have an all net flat on your VOIP account.

To do

  • configure linphone to run as actual demon so init and exit steps will not be needed (should also be faster)
  • figure out how to get separate ring tone set up on FritzBox side; the phone specific ring tone assignments to source numbers do not seem to work for internal “to all” calls; the only option may be to set up another FritzBox (if present anyways) to register like an external VOIP provider, have this make the call, and link the ring tone to that.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.