Run an automation a few days after date

I am trying to get a phone notification automation working to run my vacuum if it hasn’t been ran for a few days.

I have an automatic automation working so when everyone leaves the house, the vacuum runs and stores the date it ran.

Now I am having trouble with getting the phone notification running.

Here is what I have after researching for quite a while.

- id: '1677698617602'
  alias: Vacuum Run Notification
  description: ''
  - platform: time
    at: 09:00:00
  - condition: template
    value_template: '{{ now() - state_attr(''input_datetime.vacuum_last_ran'', ''last_triggered'')
      > timedelta( days=3 ) }}'
  - service: notify.mobile_app_jason_pixel_6_pro
      title: Run The Vacuum?
      message: It has been 3 days since the vacuum has ran, do you want to run it
        - action: URI
          title: Run Vacuum
          uri: /lovelace-mobile/vacuum
  mode: single

Turbo uber tip!

Set the date for several days after the vacuum run. Your helper would then not be “when the vacuum last ran” but rather “when the vacuum should run next time”.

Now you can use this helper in an automation to fire the vacuum up as soon as it meets the condition.

Would that only run on the date saved, or every date after that?

The date/time helper can be set to a specific date/time in the future.

If you need recurrence, use a schedule or a calendar entity instead.

It’s not on a set schedule though.

I have my vacuum set to run when everyone leaves the house.
That can be days and days of the vacuum not running. The cat hair would be deeeeep.

This is probably the best type of automation decision ever. It’s dumb to vacuum on a schedule if you have even a three-workday nine-to-five, since you will leave your home at some point, so it’s ideal to vacuum when you are not there and the noise doesn’t matter.

Every day after that, but since every time the vacuum finishes you bump it to several days ahead via automation, no problem.

Honestly I just vacuum once a day (using a date/time too!) and only when I leave the home.

What does yours look like?

In node red I have a flow that fires the vacuum if the vacuum is docked and I left home and a date time helper is on, and when the vacuum ceases to vacuum (it changes state to docked) I push the date time helper to the next day. That’s really all.

Okay, with the help of Jeff’s video from the Slacker Labs about time date stamps, I was able to get this condition working.

Here is the working value template.
{{ as_timestamp(now()) - state_attr('input_datetime.vacuum_last_ran', 'timestamp') > 259200 }}

Thanks Jeff!!