"time_pattern" trigger: support templates for "hours", "minutes", "seconds"

In blueprints it would be useful to have a possibility to define templated values for “time_pattern” components.
Consider this faulty automation:

image

description: ""
mode: single
trigger:
  - platform: time_pattern
    minutes: >-
      {{ "/1" }}
condition: []
action:
  - service: notify.persistent_notification
    data:
      message: xxx

Use case: using helpers to define a time_pattern.

You can do this with template triggers.

trigger_variables:
  entity_id: !input some_entity_selector
trigger:
- platform: template
  value_template: "{{ now().minute % states(entity_id) | int }}"
1 Like

Thank you, this is what I do now (not exactly this code, a similar one).
Just wanted to propose some more flexibility…

   {{ (now().timestamp()|int(default=0) % (MINUTES|int * 60) == 0)  }}

Yeah, this method won’t work for seconds. But then again, even if we add templates to seconds, it still won’t work for seconds because there’s nothing in templates that automatically creates a per-second resolution.

yes, and time_pattern trigger seems to support seconds (never tested myself).