This is pretty cool and useful for me, especially knowing when Thanksgiving is in the US. One question, though, in looking at the code and the result, it looks like you are examining the current year (i.e., Thanksgiving is showing up even though it has passed). I havenāt installed this yet, so maybe that was an old screenshot, but are you looking at a 12 month moving window or just the current year?
The holidays attribute includes all holidays of this and maybe next year. We do compute only āfuture holidaysā as well (and choose the first as the state) but we donāt expose that information as its own attribute. Would just a list of future holidays be useful? What kind of use case might people have for that? Easy to add if we want.
Well, for me at least, having a moving 12 month window from perhaps 30 days back to 11 months future would be pretty good. My use-case is also somewhat for holiday lighting because knowing the day after thanksgiving means I know when my lights turn on automatically. Right now I have an input-datetime that I plug in the next day-after-thanksgiving and I generally set it around October.
There are other great use-cases for knowing future holidays, such as blocking out calendars for long weekends in HA or auto-planning vacations based on āhey I take a road trip every Memorial Dayā.
I like this sensor, but i just wonder, if itās possible to turn dates around? I mean: 2022-01-22 is USA date form, while in most od EU we use other way around, so it should be 22-01-2022, or even better with dots instead of dashes, like: 22.1.2022.
Any way to do it?
This sensor is great for major holidays but what about Halloween, St. Patricks Day, Valentines Day, etc? Is it possible to add to the holiday list? I used this sensor to automate my outdoor lights based on the upcoming/current holiday. It would be great if this sensor supported non-major holidays and/or if I could add to the list. Thanks!
Hi, I want to create a sensor template which should calculate the last WORKING day of the current month.
For that I need to exclude weekends and holidays. Workday integration is good for evaluation whether today(or day with specified offset from today) is a working day.
But I need to check whether multiple dates (in sequence with steps -1 from last day of the month) are holidays or not. Installation is based on HassOS so the installation of custom components is not so free.
In case anyone is interestedā¦
This is how Iām using this and Thank you by the way for making this!!!
I created a sensor like this:
- platform: template
sensors:
holiday_time:
friendly_name: Next upcoming holiday
value_template: >
{%- set next = state_attr("sensor.next_holiday", "days_until_next_holiday") -%}
{% if state_attr("sensor.next_holiday", "today_is_holiday") == false %}
{%- if next == 1 -%} There is {{ state_attr("sensor.next_holiday", "days_until_next_holiday")}} days until {{ states("sensor.next_holiday") }}
{%- elif next > 1 -%} There are {{ state_attr("sensor.next_holiday", "days_until_next_holiday")}} days until {{ states("sensor.next_holiday") }}
{%- endif -%}
{% else %}
Today is {{ states("sensor.next_holiday")}}
{% endif %}
Seems to work through HACS if I manually add the repo. If youāre bothered, then you can create a PR for HACS to have your repo added as default here: https://hacs.xyz/docs/publish/include/
Does anyone have any thoughts on how to use this sensor for custom holidays that donāt fall on the same date every year? I think I was able to come up with a workaround for Easter ā adding Canada and the NYSE options as sources allows me to get Good Friday and Easter Monday as holidays. But it would be great to get holidays like Motherās Day (the 2nd Sunday in May) or Fatherās Day (the 3rd Sunday in June). I know the developers of the Python holiday package wonāt be adding non-official holidays, but Iām wondering if thereās a way to define these types of holidays manually.
As far as Iām aware, the custom_holidays option only allows you to specify an absolute date. Does anyone know of a way to specify custom holidays like the ones above?