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.
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.
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:
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.
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.
Just set this up, thank you!
You’re welcome and thanks for the visit!