Public holiday notifier from calendar

Hi everybody,

maybe somebody has already done this, so before trying to create it myself, I’ll ask here first :slight_smile:
Is there a way to be notified if today+1/+2/+3 is a public holiday?

I am trying to achieve the following:

  • get all public holidays in one’s region (nextcloud / google calendar) from calendar
  • create automations to automatically send notification about upcoming public holidays
  • depending on current DOW and days until next upcoming public holiday, send reminder

So let’s say May 4th was a public holiday in my country and state. In this example, May 4th is next week’s Monday. I would like home assistant to see on the previous Friday that next public holiday in today+3 and tomorrow = weekend, day after tomorrow = weekend, so therefore notify notify.telegram "Attention! Next Monday is a public holiday!! Make sure to get groceries before Saturday night!.

Europeans among you might be familiar with this problem: stores are open on Saturday, but closed on Sunday. They might be open on some holidays as well (you can shop until noon on Christmas Eve), but will be closed all day on other holidays.

It would be very helpful to be notified if one will not be able to go shopping on “regular Mondays” because a public holiday causes stores to be closed. Similar use case might be things like “Good Friday”, which -obviously- always happens on Friday. To avoid having to go on Saturday (which is then the only day between Thursday and Monday you can get groceries!), it’d be nice to be reminded on Wednesday/Thursday to get shopping out of the way before Good Friday comes.

Most people working at their workplace most likely know these holidays; I work from home and frankly don’t have to remember public holidays, so it has happened to me many times that I didn’t realize stores were closed until it was “that day” that they were already closed. And yeah, I have the holidays on a calendar on my phone (imported ics from public sources to nextcloud), but it will not notify me depending on day of week when the next public holiday will come up.

Has anybody else on here encountered this problem and already found a solution? Thanks in advance for your ideas :slight_smile:

Try the workday sensor.

Thanks. I was using it already but must have missed that there is a days offset option. Guess I could just set multiple workday sensors for different days ahead and combine them with a current day of week value.

Yeah I wasn’t sure it would do all you want, just wanted you to know that someone has already done the hard work out of working holidays out.

I must say that in my neck of the woods, the only days you need to worry about the shops being closed are Xmas Day, Good Friday and Easter Sunday. The rest of the time it is open slather. Oh and the morning of ANZAC day, where stuff is closed in the morning to encourage the vets to go to dawn parade.

It kinda works, but I will have to write a bunch of automations. So far I have created binary_sensors for today,today(+1,+2,+3,+4,+5,+6,+7) so I will know whether or not there is a holiday coming up within the next week.
But I’ll still have to figure out how to notify us depending on holidays before/after the weekend and/or two holidays in a row (Christmas Day and the day after it are both that kind of holiday where nothing is open except for gas stations and some minor exceptions).

I haven’t been to Australia/NZ, but I assume it is similar to the US where big stores are almost always open? Sometimes I miss being able to go to the store at 10pm just to get some minor groceries (and, because of being on vacation, always ending up with silly cheap walmart t-shirts as souvenirs :smiley: ).

For workday sensor, how to I specify the workday to only work on my specific state? I tried that code below but it’s giving an error

Example 2 configuration.yaml entry

binary_sensor:

  • platform: workday
    country: AU
    state: SA
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]

Possibly because your code is not yaml. But if you just forgot to format it in the post, you might have missed the fact that state: is not an option. Perhaps you meant province:?