Do you want to automatically slow down your downloads when someone is home during the day
Want full speed downloads at night or when the house is empty? This guide walks through a simple but powerful automation using Home Assistant to control both NZBGet and qBittorrent.
🧩 What You’ll Need
- Home Assistant
- NZBGet running on your network
- qBittorrent (with the Web UI enabled)
- Basic YAML editing skills
- Presence tracking set up using
personentities (e.g.,person.sharon,person.John)
📝 What It Does
This automation:
- Throttles both NZBGet and qBittorrent to less than 2MB/s each between 9AM and midnight, but only if someone is home
- Unthrottles them between midnight and 9AM or when no one is home.
- Reacts to:
- Home Assistant restarts
- Time change (9 AM)
- People arriving or leaving
🛠 Step-by-Step Setup
1. Set Up the REST and Shell Commands
Add the following to your configuration.yaml file:
rest_command:
nzbget_throttle:
url: "http://***.***.***.***:6789/jsonrpc"
method: POST
headers:
Content-Type: application/json
username: ***
password: ***
payload: >
{
"method": "config",
"params": [["DownloadRate", "2000"]],
"id": 1
}
nzbget_unthrottle:
url: "http://***.***.***.***:6789/jsonrpc"
method: POST
headers:
Content-Type: application/json
username: ***
password: ***
payload: >
{
"method": "config",
"params": [["DownloadRate", "0"]],
"id": 2
}
Replace:
***.***.***.***with the IP of the PC running NZBGet- *** for
usernameandpasswordwith your actual credentials for NZBGet
Now add shell commands for qBittorrent:
shell_command:
qbittorrent_throttle: >
bash -c "curl -s -c /tmp/qb_cookie.txt -d 'username=***&password=***' http://***.***.***.***:8080/api/v2/auth/login &&
curl -s -b /tmp/qb_cookie.txt -d 'limit=2000000' http://***.***.***.***:8080/api/v2/transfer/setDownloadLimit &&
curl -s -b /tmp/qb_cookie.txt -d 'limit=1000000' http://***.***.***.***:8080/api/v2/transfer/setUploadLimit"
qbittorrent_unthrottle: >
bash -c "curl -s -c /tmp/qb_cookie.txt -d 'username=***&password=***' http://***.***.***.***:8080/api/v2/auth/login &&
curl -s -b /tmp/qb_cookie.txt -d 'limit=0' http://***.***.***.***:8080/api/v2/transfer/setDownloadLimit &&
curl -s -b /tmp/qb_cookie.txt -d 'limit=0' http://***.***.***.***:8080/api/v2/transfer/setUploadLimit"
Replace:
***.***.***.***with the IP of the PC running qBittorrent- *** for
usernameandpasswordwith your actual credentials for qBittorrent
2. Add the Automations
In Home Assistant, go to Settings > Automations & Scenes, click + Create Automation, then Start with an empty automation.
Paste this YAML for throttling:
alias: Throttle Downloads When Home and Between 9AM–Midnight
description: >
Throttles downloads if personA or PersonB is home and the time is between 9AM and
midnight.
trigger:
- platform: state
entity_id:
- person.personA
- person.personB
- platform: time
at: "09:00:00"
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: person.PersonA
state: home
- condition: state
entity_id: person.PersonB
state: home
- condition: time
after: "09:00:00"
before: "23:59:59"
action:
- service: rest_command.nzbget_throttle
- service: shell_command.qbittorrent_throttle
- service: system_log.write
data:
message: "Throttling downloads: PersonA or PersonB is home between 9AM and midnight"
level: warning
mode: single
Replace:
person.PersonA andperson.PersonBwith people you wish to track
Now add a second automation to unthrottle:
alias: Unthrottle Downloads When Away or After Midnight
description: >
Removes download throttling if PersonA and PersonB are both away, or if it's outside
of the 9AM–midnight window.
trigger:
- platform: state
entity_id:
- person.personA
- person.personB
- platform: time
at: "00:00:00"
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.personA
state: home
- condition: not
conditions:
- condition: state
entity_id: person.personB
state: home
- condition: time
before: "09:00:00"
- condition: time
after: "23:59:59"
action:
- service: rest_command.nzbget_unthrottle
- service: shell_command.qbittorrent_unthrottle
- service: system_log.write
data:
message: "Unthrottling downloads: Both away or outside 9AM–midnight"
level: warning
mode: single
Replace:
person.PersonA andperson.PersonBwith people you wish to track
📈 Testing It
To test the setup:
- Manually trigger the automation (from the UI)
- Restart Home Assistant during daytime to confirm throttling
- Check the System Logs for throttle/unthrottle messages
- Log into NZBGet and qBittorrent to confirm download speed limits are changed
⚠️ Tips & Troubleshooting
- iPhones sometimes go into deep sleep and may delay presence detection. Consider combining
personpresence with other sensors (like network ping or Bluetooth) if you see delays. - Make sure Home Assistant can access the IPs and ports of NZBGet/qBittorrent. Windows firewalls may need exceptions.
- Confirm
DownloadRateandUploadLimitare in bytes per second, not kilobytes.
✅ Summary
You’ve now got a fully automated setup that controls your bandwidth based on who’s home and when
This helps to avoid lag, buffer, or bandwidth saturation while you are home while still taking full advantage of quiet times.
If you have found this information useful feel free to buy me a coffee to help keep this content free and online.


