Turning your Google Home Into a Customizable Alarm Clock

One of the things I’ve always wanted is a fully customizable alarm clock, not just for waking up, but for announcing the five daily prayer times with the call to prayer. After getting a Google Home, I figured I could make it happen using a Raspberry Pi and a little bit of Python.

I knew that for this to work, I would need to be able to control the Google Home from my Raspberry Pi and catt would be perfect for this. With some pretty simple cron jobs, we can have the Pi cast to our Google Home at the desired times. Now, all we have to do is work on a script to create the appropriate cron jobs.

The Script

To make things simple, we will have the script run everyday (an additional cron job) to schedule the alarms for that day. That means that the script has to do the following things.

  1. Clear the cron jobs from the previous day (use a comment to identify the right jobs).
  2. Obtain the prayer times for that day. We could use a library to calculate them but I already built a REST API in a separate project that will work great for this.
  3. Convert the times to 24-hour format.
  4. Create the cron jobs that will cast to the Google Home at the appropriate times.
job = cron.new(
        command=f'{log_cmd} && {cast_cmd}',
        comment="prayer_clock",
)

Overall, this was a simple but meaningful project. It automated something that’s part of my daily life, and I appreciated being able to hack something together. If I revisit this, I’d probably replace the daily cron job with a systemd timer or even wrap the whole thing in a tiny always-on Docker container for more control. For now, it works and every time I hear the call to prayer echo from my living room speaker, it feels a little magical.