Preventing circulations pump from getting stuck

I am trying to start my circulation pumps for lets say 2 minutes once every second week and could not find out on how to do that.

Any suggestions appreciated.

Tried this?

automation 3:
  trigger:
    - platform: time_pattern
      # You can also match on interval. This will match every 5 minutes
      minutes: "/5"

It should support days: but you can also try hours: 336

Alternatively, i have this that runs weekly:

- id: a5084c0152054338b6aed1e7638e886f
  alias: Weekly RESTART at 4 AM Tuesday
  trigger:
  - platform: time
    at: 04:00:00
  condition:
  - condition: time
    weekday:
    - tue
  action:
  - service: notify.just_me
    data:
      message: Restarting
  - service: hassio.host_reboot
  mode: single

Ow, and check this out, it seems identical to your issue:

I think this can be made to run every other week also.
If there is an action to set an input number of current weeknum +1 :

service: input_number.set_value
target:
  entity_id: input_number.pump_week_plus_one
data:
  value: '{{ now().isocalendar()[1] | int + 1 }}'

And then use a condition in the automation that current weeknum != input_number.pump_week_plus_one.
That should mean when it runs, it “blocks” next week from running, but the week after that the condition will be true.

- id: a5084c0152054338b6aed1e7638e886f
  alias: Pump every other week
  trigger:
  - platform: time
    at: 04:00:00
  condition:
  - condition: time
    weekday:
    - tue
  - condition: template
    value_template: >-
      {{ now().isocalendar()[1] | int !=
      states('input_number.pump_week_plus_one') | int }}
  action:
  - service: [ Run Pump service ]
  - service: input_number.set_value
    target:
      entity_id: input_number.pump_week_plus_one
    data:
      value: '{{ now().isocalendar()[1] | int + 1 }}'
  mode: single

EDIT:

This will only fail at new year.
You save the input number modulo 52, but that means it will fail on years with 53 weeks.
Not sure if there is a jinja for number of weeks in current year.

EDIT2:
Now that I think about it. Perhaps a better failsafe metod is to use a datetime helper and set it to next week using +timedelta(days=7). That way all the hard work is done for us and we know the condition will work.

Thanks!

:smiley:

You can also use hacs Garbage Collection. It allows most anytime combination

Here is the github repository

He also has another for holidays that adds on to Garbage Collection

It is very handy and I use it alot.

Here is how I reboot every 3 days to keep the system fresh.

garbage_collection:
  - name: Boot HACore
    frequency: "every-n-days"
    first_date: '2021-04-09'  
    period: 3

--------------------------------------------------------

alias: Reboot HA Core
description: Reboot home assistant at 11:57:19 PM
trigger:
- platform: time
  at: '23:57:19'
condition:
- condition: state
  entity_id: sensor.boot_hacore  <-- sensor is 0 on day, 1 before and 2 all other days
  state: '0'
action:
- service: homeassistant.restart
mode: single

It is very versatile