Fire Alarm! HA will call your phone via FritzBox

This automation allows you to transform a text in an audio file, make a VoIP call to a SIP url and play them to any given phonenumber.

Prerequisites

1.) Home Assistantion Installation
2.) HA AddOn hassio-addons/dss_voip at master · sdesalve/hassio-addons
3.) Fritz Box

Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.

  1. Add the Hass.io add-ons repository (https://github.com/sdesalve/hassio-addons) to your Hass.io instance.
  2. Install the “DSS VoIP Notifier” add-on.
  3. Configure at least the caller_id_uriusername, and password options.
  4. Start the “DSS VoIP Notifier” add-on.
  5. Check the logs of the “DSS VoIP Notifier” add-on to see if everything went well. Addons will wait to be invoked from an automation/script.

Configuration

NoteRemember to restart the add-on when the configuration is changed.

DSS VoIP Notifier add-on configuration:

A Fritz!Box with VoIP PBX

sip_parameters:
  caller_id_uri: 'sip:username@fritz.box:5060'
  realm: '*'
  username: 'username'
  password: 'password'
pjsua_custom_options: '--ip-addr=IP_ADDRESS'

Note: call_sip_uri in Hass.io service call must end with @fritz.box:5060. An example of URL: "sip:+473334455667@fritz.box:5060".

Please note that "pjsua_custom_options": "--ip-addr=RASPBERRY_IP_ADDRESS" is mandatory and you need to replace IP_ADDRESS with your HASSIO IP Address

NoteThis is just an example, don’t copy and paste it! Create your own!

Fritzbox configuration

Create an IP-Telephone within the FritzBox -> Telefoniegeräte -> IP-Telefon and select a name for display and specify the number being used for external calls. Then create the Login Details in the Anmeldedaten Tab.

How to use

You will need to call this addon from your Hass.io automation/script usign following yaml service invoke:

   ...
- service: hassio.addon_stdin
data_template:
addon: 89275b70_dss_voip
input: {"call_sip_uri":"sip:+473334455667@sipserver.com","message_tts":"Write here your message"}
...

Note: Make sure call_sip_uri was a SIP URI and ends with your SIP server. See samples above for some VoIP providers config. If you have to use special character in your JSON string, you can escape it using \ character.

The Automation

YAML
alias: Call on Smoke Alarm
description: ""
triggers:
  - entity_id:
      - binary_sensor.smokesensorgroup
    to: "on"
    trigger: state
conditions: []
actions:
  - data:
      addon: 0d80d722_dss_voip
      input:
        call_sip_uri: sip:017123456789@10.12.17.1:5060
        message_tts: Attention Firealarm. Please leave the building
    action: hassio.addon_stdin
mode: single
NOTE: To figure out the Addons Name ( SLUG ) you can visit the supervisor / addon page. 

The slug in the URL: mydomain.duckdns.org/hassio/addon/0d80d722_dss_voip/info

If you want to know more, here is a good read Add-on communication | Home Assistant Developer Docs