-
Notifications
You must be signed in to change notification settings - Fork 300
Examples: Sensors
Didgeridrew edited this page Jun 15, 2023
·
7 revisions
The following template will give you the results of multiple Alexa Timers.
template:
- sensor:
- name: "Alexa Timer 1"
icon: mdi:timer-outline
state: >
{% if state_attr("sensor.kitchen_original_next_timer", "sorted_active") != None %}
{% set sorted_active = state_attr("sensor.kitchen_original_next_timer", "sorted_active") | from_json %}
{% if sorted_active[0] in sorted_active %}
{{ (sorted_active[0][1].triggerTime|int /1000 - (as_timestamp(now()))) | timestamp_custom('%H:%M:%S', false)}}
{% else %}unavailable{% endif %}
{% else %}unavailable{% endif %}
attributes:
label: >
{% if state_attr("sensor.kitchen_original_next_timer", "sorted_active") != None %}
{% set sorted_active = state_attr("sensor.kitchen_original_next_timer", "sorted_active") | from_json %}
{% if sorted_active[0] in sorted_active %}
{{ sorted_active[0][1].timerLabel }}
{% else %}unavailable{% endif %}
{% else %}unavailable{% endif %}
- name: "Alexa Timer 2"
icon: mdi:timer-outline
state: >
{% if state_attr("sensor.kitchen_original_next_timer", "sorted_active") != None %}
{% set sorted_active = state_attr("sensor.kitchen_original_next_timer", "sorted_active") | from_json %}
{% if sorted_active[1] in sorted_active %}
{{ (sorted_active[1][1].triggerTime|int /1000 - (as_timestamp(now()))) | timestamp_custom('%H:%M:%S', false)}}
{% else %}unavailable{% endif %}
{% else %}unavailable{% endif %}
attributes:
label: >
{% if state_attr("sensor.kitchen_original_next_timer", "sorted_active") != None %}
{% set sorted_active = state_attr("sensor.kitchen_original_next_timer", "sorted_active") | from_json %}
{% if sorted_active[1] in sorted_active %}
{{ sorted_active[1][1].timerLabel }}
{% else %}unavailable{% endif %}
{% else %}unavailable{% endif %}