Skip to content
Didgeridrew edited this page Jun 15, 2023 · 7 revisions

Sensors


Alexa Timers

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

image