Workday sensor needs holiday exclusions list

ie: for me, vets day, columbus day and mlk day are not paid holidays. today being vets day, my HA did not fire my morning routine at the usual time because it thought it was a holiday. made me late for work.

When I read the manual

I see a excludes list

# Example configuration.yaml entry
binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, wed, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - '2018-12-26'
      - '2018-12-31'

my under standing of this is
excludes sat sun holiday
and then you do a add_holidays: and add the ones you want to exclude

1 Like

you’re basically saying, instead of excluding 3, i have to exclude ALL and then add 12.

Honestly, I’d be curious about this as well.

My previous binary_sensor.workday looks like:

- platform: workday
  country: US
  workdays: [mon, tue, wed, thu, fri]
  excludes: [sat, sun, holiday]
  add_holidays:
      - '2019-09-02'
      - '2019-11-28'
      - '2019-12-24'
      - '2019-12-25'
      - '2020-01-01'
      - '2020-05-25'
      - '2020-07-03'
      - '2020-09-07'
      - '2020-11-26'
      - '2020-12-25'

I worked today and was :thinking: why in the world were automations not working correctly…? - and then around 11am figured out that the holiday portion of my workday sensor set this value to ‘off’ - because it translated Veteran’s Day [a 100% noble holiday IMO {though still a workday for me}] into workday = false.

Anyhow, the question is then “How do I exclude a list of custom dates?”. Obviously holiday having been added within excludes: imparts some false positives - so if I remove holiday from this list, does the add_holidays: specific dates still EXCLUDE these (or because I removed holiday from the excludes: list - does it IGNORE the add_holidays list).

Or in other words, does holiday need to be in excludes: in order to utilize add_holidays date values?

What about holidays with no specific date like Thanksgiving or Easter? Or when the Friday itself falls ona weekend so you get the Monday or Friday in lieu? You can’t always be excluding explicit dates.

So, that’s kinda my point… By adding ‘holiday’ to excludes, I assumed it would use ONLY my add_holidays list only - but clearly HA took today, veterans day, as a ’ holiday’ - and screwed up all my automations based on this sensor.

Why? Or better yet / more importantly HOW do I config this sensor to use ONLY my defined holiday dates?

well im not a python coder but look like its it pulling in the holidays python module

image

so we need to go and look at that

It would be great if you could add a calendar for your holidays. This way you wouldn’t need to config every single holiday under ‘add_holidays’.

Currently I use multiple conditions for my alarm could. Is it a workday and is my holiday calendar off.

I’d also like a holiday exclusion list.

I work most public holidays and I don’t see an easy way to disable the holiday python module completely(which would be a workaround) or best, have an exclusion list.

1 Like