Personalized Alarm Messages with OpenAI and Home Assistant

Hi everyone, I wanted to share a fun project I’ve been working on to enhance my morning routine. I’ve been using Home Assistant for a while now, and I recently discovered how to integrate it with the OpenAI API to generate personalized alarm messages. It’s been a great way to add a bit of humor and variety to my mornings!

Here’s how I set it up: I created a REST API sensor in Home Assistant that calls the OpenAI API once a day. The prompt I use is ‘sarcastic alarm message’, which generates messages like:

“Oh, wonderful. Another day of productivity and excitement lies ahead. Can’t wait to jump out of bed and start tackling those thrilling tasks. Beep beep.”

Or another example:

“Good morning sunshine! Time to wake up and enjoy another fabulous day in paradise. Don’t worry about the fact that it’s already 10 am and you’ve wasted half your day sleeping. It’s not like there’s anything important you needed to do today, right?”

I then have a script that sends this message to my Amazon Echo Dot using the Alexa Media Player integration. The script also adds a quick beep sound to make it feel more like a traditional alarm. Here’s a snippet of how the automation looks:

yaml
alias: Amazon Dot Wakeup
sequence:

  • service: notify.alexa_media
    data:
    data:
    type: tts
    target: - media_player.bedroom_dot
    message: >-

I’ve been really happy with how this turned out. It’s a small but fun way to start the day, and it’s been a great learning experience working with APIs and automations in Home Assistant. I’d love to hear if anyone else has tried something similar or has tips for improving this setup!

One thing I’d note is that while the OpenAI API is powerful, it’s important to keep an eye on usage limits. I set a monthly spending cap in my OpenAI account to make sure I don’t get any surprises. Also, if you’re not already using Home Assistant, this might be a good project to dive into the platform—it’s incredibly flexible and has a great community for support.

Happy automating everyone! :blush: