Post

Use an IP phone to 'say' Home Assistant notifications

After I posted Blink lights when your IP phone rings, I kept thinking “Why not use my IP phone to ‘say’ notifications?”

The way I did it was creating a Paging Group on my FreePBX server.


Paging and Intercom


Page Group


Then in Home Assistant I have the following.

1
2
3
4
5
6
7
8
9
10
11
12
shell_command:
  mauricio_arrived: printf 'Channel: Local/724464@from-internal\nApplication: Flite\nData: "*. Welcome home, Mauricio."' > `date +"%Y%m%d%H%M%S"`.call && scp *.call root@192.168.10.10:/var/spool/asterisk/outgoing && rm *.call

automation:
  - alias: Mark Mauricio as just arrived
    trigger:
      - platform: state
        entity_id: input_boolean.mauricio_home
        from: "off"
        to: "on"
    action:
      - service: shell_command.mauricio_arrived

You must set SSH to use keys for authentication, this will prevent the system from prompting for passwords every time shell command is executed.


It will generate a file with the content below and upload it via SCP to the directory /var/spool/asterisk/outgoing on the FreePBX server. Asterisk uses files in this directory to initiate calls automatically, see this and this.

1
2
3
Channel: Local/724464@from-internal
Application: Flite
Data: "*. Welcome home, Mauricio."

I inserted *. in the text because my phone (Sangoma S500) has a two second beep that is played ‘before’ the audio, but it overlaps the beggining of the text being ‘said’. I tried removing the beep in the phone configuration, but then I had a two second silence with the same problem.


When I get home, the automation is triggered and I’m greeted with a robotic voice. 🤖

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.