returns only a single digit

It’s not easy to test using trigger states but am I right in thinking that returns a single digit for hours less than ten? (also minutes and seconds).

If so is there a good justification for this?

In any case, if I have a set of input_datetime being used as time triggers, how best to ascertain which one caused the trigger?

This doesn’t work for hours or minutes less than ten, and unless there is a better way I think I am probably asking how to pad (and minutes) with leading zeros up to 2 characters in jinja?

  - alias: Heating Downstairs Schedules

      active_schedule_no: >
        {% for schedule in states.input_datetime if schedule.object_id.startswith('heating_downstairs_schedule_time') %} 
          {% if schedule.state == ~ ":" ~ ~ ':00' %}
            {{ loop.index }}
          {% endif %} 
        {% endfor %}

      - platform: time
          - input_datetime.heating_downstairs_schedule_time1
          - input_datetime.heating_downstairs_schedule_time2
          - input_datetime.heating_downstairs_schedule_time3
          - input_datetime.heating_downstairs_schedule_time4
          - input_datetime.heating_downstairs_schedule_time5
          - input_datetime.heating_downstairs_schedule_time6


Yes. It’s returning an integer value (not a string).

An input_datetime has attributes for hour and minute and they are integer values. You can refer to them in your template.

      {% if schedule.attributes.hour == and schedule.attributes.minute == %}
1 Like