Integrating and controlling Transmission with Home Assistant

No comments
Disclosure: This post contains affiliate links. If you click through and make a purchase, I’ll earn a commission, at no additional cost to you. Read my full disclosure here.
Advertisement
cyberpunk-tutle-graphic-full

One of the joys of using Home Assistant for me personally is not just controlling physical devices such as lights, media players, and PCs but also being able to control other applications I have installed on my home server. One of those applications is Transmission, the popular lightweight BitTorrent client.

Advertisement

I run Transmission in a Docker container on the same host as my Home Assistant Core container. It stays on 24/7 because there are just too many “Linux ISOs” available. But I don’t want my Torrent downloading to affect my general browsing experience when I am at home. And that is where today’s featured automation is practical.

Table of Contents

Requirements for integrating Home Assistant with Transmission

The steps laid out in this guide apply to all of Home Assistant’s installation methods. Whether you are running the Home Assistant Operating System on a Raspberry Pi, or Home Assistant Core in a Docker configuration. All you will need is to be able to access the Home Assistant Dashboard. You will obviously also need to have Transmission up and running. Depending on your setup, you will have to enable remote access to Transmission.

Advertisement

Next, you will want to make sure you have configured the alternative speeds (often called turtle mode due to the icon being a turtle) in your Transmission client. These should be low enough for Transmission to not be noticeable when browsing and downloading in your home network.

How to integrate Transmission with Home Assistant

The Transmission integration is easily set up in Home Assistant. It is all done using the graphical web interface and no YAML code is involved. All you need is the host (i.e., Transmission’s IP address), the username and password (if set up), and the correct port, which is by default 9091. Navigate to your integrations overview, and search for ‘transmission‘ in the list of available integrations.

Open your Home Assistant instance and start setting up a new integration.

Alternatively, you can click in the link above, which will take you directly to the setup of Transmission. This link is provided by Home Assistant, as can be seen on their integration page. Whichever option you choose, once you have entered your information, you will be presented with a list of available sensors and switches.

Advertisement

What sensors does the Transmission integration with Home Assistant provide?

  • One sensor will tell you whether you are currently only seeding, or whether you are also downloading. This information is displayed as the Transmission daemon’s status.
  • To help you keep tabs on how much bandwidth your torrent downloading is taking up, there are individual sensors for the current download and upload speed.
  • A further five sensors display current number of active, paused, started, completed, and total number of torrents.

What switches does the Transmission integration with Home Assistant provide?

  • A switch to start/stop all torrents (switch.transmission_switch)
  • A switch to enable turtle mode (transmission_turtle_mode)

It is the latter Transmission switch that will be most useful in Home Assistant automations. If you have enough bandwidth to spare, you likely won’t ever want to completely stop all torrents in Transmission. What you will want to do is throttle Transmission, when you are using the same network, and let it rip when the smart home is empty.

What Events does the Transmission integration with Home Assistant provide?

Besides providing Switches and Sensors, the Transmission integration with Home Assistant also provides several events, which can be used in various automations, such as notifications. The usable events are the following:

Advertisement
  • transmission_downloaded_torrent
  • transmission_started_torrent
  • transmission_removed_torrent

What Services does the Transmission integration with Home Assistant provide?

Finally, the Transmission integration with Home Assistant also offers four services. These let you add, remove, start, and stop torrents directly from the Home Assistant Dashboard. I obviously can’t judge whether you will make much use of these, but with Sonarr, Radarr, and the likes in place, I have already automated my torrenting using more suited applications.

Creating the Transmission turtle mode automation in Home Assistant

The following Transmission automation was created using trigger IDs. It enables much simpler and also shorter automations. In this case, I have created two triggers, one fires when I am at home, the other fires when I leave. I have given each trigger an appropriate name, which can later be used in the actions.

To make use of the Trigger IDs in this automation, you must select the choose action type. First, create an option for turning turtle mode off (i.e., letting Transmission download at full speed). To accomplish this, select the triggered by condition time, and select the appropriate trigger ID. Under actions, select the switch: turn off service, and select the Transmission Turtle Mode entity.

Creating the Transmission Turtle Mode automation in Node-RED

I’m using Node-RED for this automation, but it should translate to YAML code fairly easily. It should also be doable using the Home Assistant UI for automations. For this example, I’m using three basic flows. The first two will fire whenever me or my partner leave the home. They’ll then check if the other person is still home. If they aren’t home, Transmission will be allowed to download at full speed. If the other person is home, it will do nothing.

Turning on Transmission turtle mode using Node-RED and Home Assistant

The third flow is even more basic. It will enable turtle mode whenever someone enters the home.

Advertisement
Turning off Transmission turtle mode using Node-RED and Home Assistant
call service setup in node-red

Further ideas for Transmission automations

The setup I’ve just described is obviously very basic. But there are many ways in which you could expand on the examples I’ve presented. Here are some ideas to get you started:

  • Disable turtle mode when everyone is sleeping.
  • Enable turtle mode when someone is using your Plex server even if you’re out of the home.
  • Create a kill-switch for when you need all the bandwidth (could be physical or in the Home Assistant UI)

Transmission sensors and switches in the Home Assistant UI

If you’ve already set up the Transmission integration in Home Assistant, you may aswell create some nice graphs for your up- and downloads. Here’s what mine looks like using the Lovelace Mini Graph Card. And I’ve also created a big physical button for the turtle mode using a Button Card.

Transmission speed in the Home Assistant UI
Transmission switch in the Home Assistant UI

Leave a comment

Share to...