Connecting your Landline to Home Assistant for CallerID Notifications

home assistant landline phoneWhen going through my box of old unused tech gear the other day I found a USB 56K modem that I purchased off eBay a few years back. I instantly thought maybe I can use this with Home Assistant. I checked out the Home Assistant websites integration page and sure enough you can. Below I outline what I did to get the modem up and running on my Home Assistant install that is running on Proxmox, along with an automation I used to announce the caller id feature that my landline provider supplies.

The modem I use is a cheap (under $30) no name modem that I purchase off eBay to use with caller id on media portal, I have not used that software in years so the modem has been gathering dust for a fair while. It is possible that not all modems are going to work, but this modem with the Conexant Chipset works fine on my system. A recent search for USB modems on eBay seem to show that the same modem is still available. If you have any luck with other models let us know in the comments below.

usb 56k conexant modem
My 56k Modem

Passing through your modem in Proxmox to Home Assistant

If you use Home Assistant in a Virtual Machine environment like I do on Proxmox, then you will need to pass through the USB port to the VM. If you use Home Assistant on a Raspberry Pi then you can skip this step.

In Proxmox select your Home Assistant VM, then click  on “Hardware”, then “Add” followed by “USB Device”.

proxmox home assistant modem add

Now select your Modem and restart your Home Assistant VM.

proxmox modem to ha vm

Finding your Modem in Home Assistant

Once Home Assistant restarts after adding your modem, click on “Supervisor”, followed by “System” then click on the 3 dots to bring up the “Hardware” option.

Ha hardware supervisor

Now you will see a list of all your hardware, you will need to find your USB Modem like I have below.

modem in ha supervisor

Configuring Home Assistant with your Modem details

Now fill out your Home Assistant configuration file sensor section with this additional platform called modem_callerid. You will need to replace the device shown here with your device that you found earlier in the supervisor hardware section.

sensor:
  - platform: modem_callerid
    device: /dev/serial/by-id/usb-Conexant_USB_Modem_24680246-if00

Once you check your config and restart Home Assistant, you will have a new entity called sensor.modem_callerid that will look like below.

sensor.modem_callerid

Caller ID Automations

Now we can have fun with automations, I have a Google home speaker announce who is calling via text to speech. There is only a handful of people I know who ring my landline, the rest are generally scam or marketing calls that I choose to ignore. Below is an example of my automation. For some reason silent numbers come up as 0anonymous that sounds odd when read out by TTS, so I also change this to something more understandable.

- id: say-caller-id
  alias: Say CallerID Day
  trigger:
    platform: state
    entity_id: sensor.modem_callerid
    to: callerid
  condition:
    condition: time
    after: 08:40:00
    before: "22:30:00"
  action:
    service: tts.google_translate_say
    entity_id: media_player.hallway_speaker
    data_template:
      message:
        '{% if state_attr(''sensor.modem_callerid'', ''cid_number'')== "0415555207"  %} Call from Bob
        {% elif state_attr(''sensor.modem_callerid'', ''cid_number'')== "0415555408" %} Call from Bill
        {% elif state_attr(''sensor.modem_callerid'', ''cid_number'')== "0415555306" %} Call from Mum
        {% elif state_attr(''sensor.modem_callerid'', ''cid_number'')== "0415555609" %} Call from Dad
        {% elif state_attr(''sensor.modem_callerid'', ''cid_name'')== "0anonymous" %} Call from a Silent Number
        {% else %}
        Call from {{ state_attr(''sensor.modem_callerid'', ''cid_name'') }}
        {% endif %}'

Wrap Up

This has been a fun and useful additional to My Home Assistant setup that has not cost me anything as I already had the modem lying around. It must be noted that not all phone providers do CallerID and some only do it for an extra charge. In Australia, we are limited to just displaying of the incoming number, hence my script to change this into a text string name. If you added a lot of your family and friends this script could get rather long. If you have had your own experiences with Home Assistant and CallerID let us know below.

Resources

Home Assistant Modem CallerID page.