WTH Isn't There a "Date" Automation Trigger/Condition?

There are time based events, but why must I create a custom helper to get a date to run in automations or conditions?

Automation for Christmas Lights:
“On December 25th do…”
“If Lights turns on, and today’s date is December 25th do…”

Automation for Hanukkah Lights:
“After December 25th and before January 2nd do…”

Use calendar integration?

1 Like

Date condition is in the works, I remember a PR going through the system. If I recall correctly, it’s going through reviews as we speak.

9 Likes

I was looking to post almost the same WTH, but I was looking for a solution that is much more intuitive than just a date, for example trigger on the 4th Thursday in November - right now I have to hard code a date in a value template, which means I have to touch that automation once a year.

Local calendar can do that

WTH- I can trigger an event by day of the week, time of day, sunrise/sunset, etc. But if I want to set my Xmas scene on Dec 1 I have to be an engineer. Please make calendar dates as easy to use as day/time!

I believe this is shipping this Wednesday in 2024.12

Oh where do you see that?

Could be wrong about ship date.

Maybe you want a conditional Sections card to only appear during a certain month. E.g., Christmas stuff to only appear during Christmas time. It would be great if we could select an exact date or month just as easily as we can select days of the week.

How? Please point me in the right direction.

Use the Holiday integration to create a calendar entity with the holidays you are interested in.

Then create an automation using a calendar trigger, and select that newly-created calendar entity.

Then add a template condition using the calendar trigger variable to check if the event is thanksgiving, using a template like this:

{{ trigger.calendar_event.summary == 'Thanksgiving' }}

Edit: this was in response to @RickFurtado and @mwjones71

Edit #2: before anyone assumes I’m suggesting this WTH is not valid, that is not my intent. I’m simply showing there exists a method to do this already; I’m not saying it shouldn’t be simpler. And, also, anything can be done using templates, but that is another method that many will think is even more complicated.

I would like to add the following options for date conditions:

  • Is it Wednesday, Friday or Saturday? (Weekday)
  • Is it march or april? (Month)
  • Is is a 12., 13. or 14. day of the month? (Day)
  • Is it between 11. October and 20. November? (Date-range)
  • Is it 2024? (Year)

This shows the problem with date / times: the whole subject is incredibly complicated.

Weekday already exists in conditions.

The rest need simple templates, although I do understand that some people think you need an engineering degree to understand these:

- "{{ now().month in (3,4) }}"
- "{{ 12 <= now().day <= 14 }}"
- "{{ (10,11) <= (now().month, now().day) <= (11,20) }}"
- "{{ now().year == 2024 }}"

The advantage of templates is that they’re flexible enough to cater for any additional option you can think of, whereas the UI for including extras gets messy fast.

1 Like

While I’m somewhat able to make YAML-statements, I think these options should be available for regular people without much technical knowledge.

Agreed if all the options can be presented in a way that isn’t going to end up causing more problems. We already get quite a few questions from people guessing what to put in the Attribute field of the state trigger (hint: leave it blank unless you know better) and that’s a simple UI.

To be pedantic, that’s Jinja not YAML (except the leading hyphen). You can use these in the UI.

image

1 Like

I think most of us know we can do almost everything using additional integration, tricky templates, delays or create different automations just for a simple action

But i feel the request is to have an easy way to have different automation based on calendar/ days condition nativelly on HA. some examples…

  • anything that is triggered/condition is every weekend
  • anything that is triggered/condition is every first Monday of the month
  • Easy way to have a device on nor off for a period of time…

I feel scheduler card is a good example of something similar should be part of HA natively

Schedule helper is:

and can do #1 and #3 from your list. Then create an automation based off that.

And #2 can be solved with local calendar and a reoccurring event on the first day of the month.