Last Friday of a specific month automation

I’m looking to create an automation that disables other automations basically 1x per year. I want to have an automation that runs on the “Last Friday of October”. How can I make that happen?


At what time of the day (on the last Friday of the month) do you want the automation to run?

The following example assumes you want it to run at 08:00:00. Change it to whatever you require.

alias: example
  - platform: time
    at: '08:00:00'
  - condition: template
    value_template: >
      {{ now().isoweekday() == 5 and now().month == 10 and 
        now().month != (now() + timedelta(days=7)).month }}
  ... your actions go here ...

How the template works

This confirms today is Friday:

now().isoweekday() == 5 

This confirms the current month is October:

now().month == 10 

This confirms the current month is not the same as the month in 7 days (i.e. next Friday is in a different month).

now().month != (now() + timedelta(days=7)).month

If both tests are true then the current Friday is the last one in October.


Today is Friday October 27 and is the last Friday in October. Here’s the template confirming it’s the last Friday of the month.


Correction. I overlooked your requirement that it must be the last Friday of a specific month, namely October (as opposed to the last Friday of any month). I have amended the template and it now also checks if the current month is the 10th month of the year (October).


Thank you!!

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information, refer to guideline 21 in the FAQ.