Home-Assistant: Wake Up Alarm with a Phone Call

March 9, 2021

Video Demo:

Update 2/25/2022

I put together the video above and presented the project during the Twilio Services Kickoff Demo Jam competition -- I got 3rd place! Woohoo🥉

Twilio 3rd Place (Front)

Twilio 3rd Place (Back)


Sometimes it's hard for me to get out of bed in the morning. I've tried a ton of things:

But I always enjoyed getting the wake up call on business trips. Going off of that idea, I set up a landline in my house and acquired a really annoying loud phone with an actual bell to call me in the morning and wake me up with a quick math problem to get my brain activity going.

If this doesn’t work, I’ll have to look into making an ejector bed lol

Twilio Wake Up Call ejector bed gif

Try it out yourself:

Call this number: (415) 358-6870

It will ask you a simple math question and tell you if you’re right or wrong. If you get scared talking to people on the phone, don’t be. It’s just a robot on the other side.

Getting Started on the Twilio Console

First, I pulled up the Twilio Console and purchased a phone number ($1/mo)

Next, I navigated into Twilio Studio and built a Studio Flow that calls you when you hit the Studio Flow URL with a request from Home-Assistant.

Twilio Wake Up Call Studio Flow

I've glossed over how I created the Flow, but it went through a couple iterations. Basically, I built a function that picks a random, whole, positive number in a simple equation that always returned a whole and positive number as an answer. It's running in a Twilio Function that is run during the call, so there is sometimes a longer pause because it has to run the function a few times if one of the conditions isn't met. I'm sure there are better ways to accomplish it, but this works for me. The entire interaction is less than 30 seconds.

After that I needed a way in Home-Assistant to trigger the REST command and ultimately in an automation.

Home-Assistant REST Command:

This REST command triggers a phone call to the number specified in it.

    url: "https://studio.twilio.com/v2/Flows/FW79cc6cc54bddc17e431f9e3d27fe8da1/Executions"
    method: POST
      Content-Type: "application/x-www-form-urlencoded"
    username: ACxxxxxxxxxx9918e978bdb60ca6a90f5c
    password: bxxxxxxxxxxxaf5cc3d655d5fef5cf15b
    payload: "To=+16501234567&From=+14153586870"
# replace the To Number with yours. Leave the From Number as is -- this is the number you’ll get a call from!
# keep the URL the same to use my Flow!

Home-Assistant Automation:

I’m using Node-Red to trigger my wake up automation. It looks like there’s a lot going on, but basically I only trigger the the alarm based on certain conditions:

  1. A switch on the dashboard is turned on (for example, I turn it off during a holiday)
  2. I’m physically home
  3. It’s a work day at 7am

Twilio Wake Up Call Node Red Automation

You can also trigger the REST command with a normal automation within Home-Assistant.

Triggering a Test Call

During the testing phase, I wanted a button on my dashboard that I could press and trigger the phone call. Unfortunately, it’s never that easy lol -- I had to use a custom button-card so I could call a service (the REST command) from the button. You can’t trigger a service from a normal button card!

Twilio Wake Up Call Button Card

Bonus: Get a landline to connect a “old” telephone

Last thing is I needed a landline. I bought a Grandstream HT801 Analog Telephone Adapter and set it up with Twilio SIP. You can read more about how I set that up in this blog post. I plugged it in, configured it, and then connected it to my home phone network.

Once I did that, I was able to have an old landline telephone connected to the Telephone network with a phone number.

Now every morning, I get a wake up call and it asks me to do a simple math question. Nothing peaks my anxiety like trying to solve mental math questions on the spot early in the morning!

Twilio Wake Up Call phone meme guy picture

Future Ideas

It'd be fun to see if I can pull a Quote of the Day from an API to provide morning motivation to users getting ready to wake up.

This was added!

Setting it up for yourself

If you're interested in setting this up for yourself, please contact me. I'm happy to help you set this up and we might be able to set up a way where you can use my Studio Flow and Phone Number.