The following Trigger-based Template Sensor records the name and time of the last 10 transmission_downloaded_torrent
events.
template:
- trigger:
- platform: event
event_type: transmission_downloaded_torrent
sensor:
- name: Recent Torrent Downloads
state: "{{ now().timestamp() | timestamp_custom() }}"
attributes:
downloads: >
{% set current = this.attributes.get('downloads', []) %}
{% set new = [{
"name": trigger.event.data.name,
"time": now().isoformat() }] %}
{{ (new + current)[:10] }}
You can use a Markdown Card to display the download events using the following template:
|Name||Time|
|:----|:-:|:----|
{% for x in state_attr('sensor.recent_torrent_downloads', 'downloads') | default([], true) -%}
|{{x.name}}||{{x.time|as_timestamp|timestamp_custom}}|
{% endfor -%}
Let me know if you need any additional assistance.