Monitor your website using Home Assistant and Uptime Robot

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

Close-up of an unplugged Ethernet cable with a clear connector lying on a textured black surface. The cable is beige and slightly curved, with the unplugged end in focus and the rest of the cable blurring into the background.
Update: Oct 9, 2021

Say Goodbye to YAML

In an exciting development, Home Assistant has levelled up its UptimeRobot game and can now be integrated directly through the Home Assistant Dashboard. Gone are the days when you had to tediously set up the integration and store the API key in your configuration.yaml and secrets.yaml files.

Now, you just need to pop that key into the integration settings of Home Assistant and voilà, you're all set! This update not only takes a load off your shoulders, but also adds an extra layer of convenience to your tech experience. So, no need to fret about YAML files any more. Easy-peasy, right?

If you've ever taken a peek at the footer of this site, you'd know that I'm the puppet master behind quite a few websites. Now, I could go the old-school route and manually check if my websites are up and running by visiting them time and again, or even set up a script to ping them at regular intervals. But let's be real, who has time for that in this age of automation? Enter UptimeRobot, the website status checker that seamlessly integrates with Home Assistant and does all the hard work for you.

Contents

Getting Started with UptimeRobot

To kick things off, you need to sign up for a free account with UptimeRobot. And while you're at it, don't forget to enable two-factor authentication for added security. As for me, I didn't find the need to shell out for the premium plan since Home Assistant does a stellar job of notifying me if there's any downtime. Once your account is up and running, you can add a new monitor.

A screenshot of UptimeRobot showing how a new monitor is added
Setting up a HTTP(s) monitor in Uptime Robot

Here's how you do it: Choose the HTTP(s) monitor type, enter your website’s name and URL, then hit 'Create Monitor'. Voilà! Your site is now under the watchful eyes of UptimeRobot. The free version checks your website every five minutes. The next step is to create a read-only API key.

To achieve this, head over to the 'My Settings' section on the dashboard. Scroll down to API Settings, from where you can create a new read-only API key. This key will be used in the Home Assistant configuration.

Integrating UptimeRobot with Home Assistant

It's a good idea to stash the UptimeRobot API key in your secrets.yaml file, since it's not something you'd want to share with anyone. I named mine uptimerobot_api_key for simplicity. The next order of business is to set up a new binary_sensor using YAML, as UptimeRobot doesn't offer a UI configuration option. Here's the code you need to add:

platform: uptimerobot
api_key: !secret uptimerobot_api_key

Once you restart Home Assistant, you should spot a new binary_sensor named binary_sensor.website_name in your developer tools. If you do, congrats! You've successfully set up the UptimeRobot integration, and your new sensor is ready for action.

An Uptime Robot binary sensor in Home Assistant

Making the Most of the UptimeRobot Integration

Now that Home Assistant is keeping tabs on your website's status, you can use this data in your automations and scripts. I went ahead and added an entity card to my Home Assistant dashboard, so I can keep track of the status right from the web interface.

The most straightforward automation you can set up is to send a notification when the website goes offline. But why stop there? You could also program a light to turn red or make your Nest speakers announce that your website is down. With Home Assistant, the sky's the limit.

Home Assistant Uptime Robot 04
A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Comments

Leave a comment

Share to...