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.

* ✏️ Tweaks
This commit is contained in:
J.P. Hutchins 2019-11-06 13:06:22 -08:00 committed by Franck Nijhof
parent 9747e9afa2
commit c9e162a2c0

View File

@ -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 %}