In this guide, I will show you how you can integrate Sonarr, the popular PVR (personal video recorder) software, with Home Assistant. I will cover the basics as well as the more advanced custom Upcoming Media Cards along with the Sonarr Upcoming Media integration available for the Lovelace UI.
What is Sonarr
Sonarr tracks and automatically gathers data from indexers for TV shows. It is a popular, and in my opinion, a far superior, alternative to Sick Beard and SiCKRAGE and is essential for anyone wanting to automate their downloads of TV shows.
Using Sonarr, you can monitor TV shows you’ve already downloaded for missing episodes, and it will automatically search for new episodes.
Disclaimer: If you’re downloading a TV shows for which you don’t already own a physical copy, you are probably parking the law. Only ever download what you have the right to do so. Home Assistant Guide not condone piracy in any shape or form.
A word on Sonarr v3
Sonarr v3 is an upcoming update that will introduce a ton of new stuff. The interface has been redesigned, there will be search filters, and Drone Factory has been removed to just name a few changes. Sonarr v3 will be compatible with everything described in this guide. However, this guide was created using the latest stable release.
Integrating Sonarr with Home Assistant
The Sonarr integration has been migrated to the UI and thus couldn’t be easier to set up. Click on
Configuration in the menu and select
Integrations. From there, click on the big
+ button and search for
Next, you’ll want to open up Sonarr and enter the settings. Under
General look for your API key (make sure you never share this key). Copy the key and head back into Home Assistant. Enter the Sonarr API key along with the host (IP address), path to the API (can be left as it is), and Sonarr’s port. If the information you entered is correct, you should be notified of the successful integration.
By default, only one of the six entities will be enabled. To enable all you can click on
1 service and then select
Activity Sensor. Under entities expand the five disabled entities. You can click on each individual entity and enable it.
Sonarr sensors in Home Assistant
This integration will give you six sensors to work with. Let’s go through them one by one.
Sonarr Commands (sensor.sonarr_commands)
This sensor will display the commands Sonarr is executing. Is this useful? Not for me personally. I use Sonarr more or less as a “set it and forget it” service. I’m not all too interested in what Sonarr is doing at any given minute.
Sonarr Disk Space (sensor.sonarr_disk_space)
Another sensor I don’t really see myself using. This sensor will tell you how large your Sonarr folders are. I use the Glances integration to monitor the disk space on my Unraid rig and that’s all I need.
Sonarr Queue (sensor.sonarr_queue)
Tells you how many episodes are currently in your queue.
Sonarr Shows (sensor.sonarr_shows)
This sensor monitors how many shows you have added to Sonarr in total and will list each show as an attribute. This one could be useful if you like adding nice graphs to your Lovelace UI.
Sonarr Upcoming (sensor.sonarr_upcoming)
Tells you how many episodes are listed as upcoming and lists those episodes as attributes.
Sonarr Wanted (sensor.sonarr_wanted)
This sensor monitors how many episodes are listed as wanted and will list those shows as attributes.
Is that all?
At this point, you might be wondering if what I’ve just listed is everything you can do with the Sonarr. Because let’s be honest for a moment, none of the sensors is really all too useful. But don’t worry, there is more!
Display upcoming episodes in Home Assistant
Thanks to a custom integration and a custom Lovelace UI card you can display upcoming episodes in your frontend. For this to work you will have to install two components from HACS:
Once installed you will have to add the custom integration with a few lines of YAML. As with the previous integration, you will have to enter your API key, your host, and your port:
sensor: - platform: sonarr_upcoming_media api_key: YOUR_API_KEY host: YOUR_HOST port: YOU_PORT days: 7 ssl: false max: 10