This is my first automation so apologies if it isn’t ‘perfect’ but it does what it needs to do, I’ll add some additional options like a time condition etc. if people want.
To get this automation to work you will need to add the following
Plex Media Server Integration
sabNZBD Integration
Once you have both of these setup, run the blueprint and make sure to find the ‘Plex Media Server Sensor’ it’s not a media_player.
The automation will wait for 0 active Plex users before returning to 100% download speed. Happy to add some further inputs if you would like some more flexibility around this?
blueprint:
name: Set sabNZBD Speed if users watching Plex
description: >
This automation blueprint will allow you to adjust the download speeds of your sabNZBD client based on your Plex server
domain: automation
input:
plexserver:
name: Plex Media Server
description: The Media Server you want to trigger the automation
selector:
entity:
domain: sensor
speed:
name: Throttle Speed
description: Adjust the speed at which sabNZBD will download - eg 50% will be 50% of your total download speed.
default: ""
selector:
number:
min: 0
max: 100
unit_of_measurement: "%"
mode: slider
no_of_users:
name: No. Of Users
description: Set the No of Users needed to trigger this automation.
default: "1"
selector:
number:
min: 1
max: 100
unit_of_measurement: "Users"
mode: box
trigger:
platform: state
entity_id: !input plexserver
from: "0"
to: "!input no_of_users"
variables:
plexserver: !input plexserver
speed: !input speed
action:
- service: sabnzbd.set_speed
data:
speed: "{{speed}}"
- wait_for_trigger:
- platform: state
entity_id: !input plexserver
to: "0"
- service: sabnzbd.set_speed
data:
speed: 100