From c9e162a2c07786f5bd28944ee363ab924a1fa647 Mon Sep 17 00:00:00 2001 From: "J.P. Hutchins" <34154542+JPHutchins@users.noreply.github.com> Date: Wed, 6 Nov 2019 13:06:22 -0800 Subject: [PATCH] Add info about torrents that is accessible with templating (#10574) * Add documentation corresponding to PR #27111 https://github.com/home-assistant/home-assistant/pull/27111 * Add ```jinja2 to code tag. * Try ```raw to get passed liquid syntax error. * Add Jekyll {raw} and {endraw}. Still trying to pass jinja2 excerpt. * Update docs corresponding to removal of torrent_info sensor. * :pencil2: Tweaks --- source/_integrations/transmission.markdown | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/_integrations/transmission.markdown b/source/_integrations/transmission.markdown index c4e1f554849..8981e96f6fc 100644 --- a/source/_integrations/transmission.markdown +++ b/source/_integrations/transmission.markdown @@ -120,3 +120,21 @@ Adds a new torrent to download. It can either be a URL (http, https or ftp), mag | Service data attribute | Optional | Description | | ---------------------- | -------- | ----------- | | `torrent` | no | Torrent to download + +## Templating + +### Sensor `started_torrents` + +The state attribute `torrent_info` contains information about the torrents that are currently downloading. You can see this information in **Developer Tools** -> **States** -> `sensor.transmission_started_torrents` -> **Attributes**, or by adding a Markdown Card to Lovelace. + +{% raw %} +```yaml +content: > + {% set payload = state_attr('sensor.transmission_started_torrents', 'torrent_info') %} + + {% for torrent in payload.items() %} {% set name = torrent[0] %} {% set data = torrent[1] %} + + {{ name|truncate(20) }} is {{ data.percent_done }}% complete, {{ data.eta }} remaining {% endfor %} +type: markdown +``` +{% endraw %}