Trigger template sensor 1 second before every 15 min of the hour

Hi All,

I am trying to build a template sensor that updates 1 second before every 15 min on of the hour, So i need it to trigger at 1:14:59, 1:29:59, 1:44:59, 1:59:59 etc… I have a trigger thats working for every 15 min but dont know how to make it trigger before the 15th min reliably

This is my current trigger

  • trigger:
    • platform: time_pattern
      minutes: “/14”
      second: “59”

This works and trigger on the 1:14:59 but will trigger at 02:00:59

Any help would be great.

Thanks

“/14” means divisible by 14, so 14, 28,etc. Normal cron would support the following:

59 14,29,44,59 * * * * *

So you could try:

minutes: "14,29,44,59"
second: "59"

I have not tested.

I think it’s got to be 4 time pattern triggers…

trigger:
  - platform: time_pattern
    minutes: "14"
    seconds: "59"
  - platform: time_pattern
    minutes: "29"
    seconds: "59"
  - platform: time_pattern
    minutes: "44"
    seconds: "59"
  - platform: time_pattern
    minutes: "59"
    seconds: "59"

This is the way, though one slight change to the solution you have posted. It seconds not second It took me a while to trouble shoot that one as the output from logs on template sensor are not great!

updated with seconds not second

1 Like