Monitoring my VOIP provider with Home Assistant
The worst time to find out that your telephones aren’t working is when you pick up the phone to try to make a call.
I have a small Cisco ATA (SPA122) that sits in my basement and connects to all of the telephone ports throughout the house. It has two VOIP provider lines on it, and generally provides us with pretty reliable telephone service at a reasonable monthly rate.
In order to make it more reliable, I was going to have to figure out a way to identify when it wasn’t working.
Reading the Cisco ATA API documentation
I found out that the Cisco ATA (SPA122) has documentation readily available for business level deployments for automating the configuration. I also discovered that there was an XML document that tells you the status of the router that is easily accessible at /admin/status.xml&xuser=*****&xpassword=*****
This would allow me to check to see if the phone lines were connected properly with my VOIP provider. Next I needed to integrate it with something to notify me when things weren’t working.
Integrating it into Home Assistant
I use home-assistant.io as a home automation platform in my house. What’s great about it is it’s written in Python, open source, and has a large community surrounding it. Unfortunately, there wasn’t anything already built for my Cisco ATA. In order to get the phone line data into Home Assistant I was going to have to write something myself.
There are 2 components that are necessary for this to work. I needed to write a python utility that could connect to the ATA and grab the status information so that it could be used within Home Assistant to display that data.
I decided to write, an open source my first python module called pyciscsospa you can download it and use it for your own ATA as well.
I then needed to write a custom component to display the phone data that leverages the python module.
Home Assistant Config
In order to integrate with Home Assistant I added the following configuration:
- platform: ciscospa
In order to receive a push notification on my phone when the phone lines go down and come back up, I added the following automation to my setup.
- alias: "Notify when phone offline"
title: "Home phone offline"
message: "Line 1 is down right now."
- alias: "Notify when phone online"
title: "Home phone is back online"
message: "Line 1 is back online"
I’m now notified as soon as there is an issue with my VOIP system at home. Currently the custom component is not available as part of the Home Assistant project, but if you’re interested in using it let me know and I’m happy to share.