The Transmission integration provides a useful transmission_downloaded_torrent
event, and a useful transmission.remove_torrent
service, however using these together is not so easy since the event only includes the torrent name
in the event data.
For example if I want to do something with the downloaded file after it’s complete such as remove it from the torrent client which is done by ID, based on the example automation I expected to be able to do something like this:
alias: Remove on successful download
trigger:
platform: event
event_type: transmission_downloaded_torrent
action:
service: transmission.remove_torrent
data:
name: Transmission
id: "{{trigger.event.data.id}}"
But id
doesn’t seem to exist on data
, only name
exists. So for now I have to do something like this:
alias: Remove on successful download
trigger:
platform: event
event_type: transmission_downloaded_torrent
action:
- delay: '00:00:02'
- service: transmission.remove_torrent
data:
name: Transmission
id: >-
{{ state_attr('sensor.transmission_completed_torrents',
'torrent_info')[trigger.event.data.name].id | int }}
(I seem to have to wait a couple seconds for sensor.transmission_completed_torrents
to update)
The first example would be much better. Can the torrent ID be added to the event data? Or perhaps someone like @engrbm87 or @JPHutchins knows why the ID is not present?
Also discussed in: Transmission remove_torrent