Workday 'add_holidays' not working

I’m using a couple workday binary sensors, and I can’t get the ‘Add Holidays’ feature to work. This is my configuration to determine if tomorrow is a workday:

  - platform: workday
    name: Workday_Tomorrow
    days_offset: 1
    country: US
    province: PA
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun]
    add_holidays:
      - "2021-11-25"
      - "2021-11-26"
      - "2021-12-23"
      - "2021-12-24"
      - "2021-12-25"
      - "2021-12-31"

This has been copied directly from the examples in the Workday page. Tomorrow (11/25) is set to be a holiday, but it doesn’t show up. In my dashboard and Developer Tools, it shows as ‘on’, and in Developer Tools, I don’t even see the holidays added in ‘State Attributes’

Screen Shot 2021-11-24 at 7.47.40 AM

I’m fairly new to Home Assistant, and haven’t quite gotten the hang of YAML yet, but from what I can see, it should be working. Can someone help me figure out what is going wrong here?

I didn’t notice anything wrong with your configuration, but someone else very well may.

Just to be sure, have you gone to the Server Controls, checked your configuration, and restarted the server?

Many times.

I even recopied the code from the example, using the exact code (changing only the date and name), and restarted the server but it still doesn’t work properly.

  - platform: workday
    name: Workday_TEST
    country: US
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun]
    add_holidays:
      - "2021-11-24"
      - "2021-11-25"

Screen Shot 2021-11-24 at 10.54.03 AM

The docs make it seem unnecessary, but have you tried including holidays in your list for excludes?

I believe I did, but I’ll check again. According to the example I copied, it shouldn’t be necessary (Plus, I don’t k now how to tell exactly which days that includes, so I would prefer to leave it out so it doesn’t include a date that I do have to work)

Edit: I just added ‘holiday’ to the excludes and restarted, but it only shows ‘sat’ and ‘sun’ in the developer tools. I’m going to add an offset and restart again so I can see if it is registering tomorrow as a holiday.

I added ‘holiday’ to the exclude list, and it does register tomorrow as a holiday, but it does not register Friday as a holiday, so it’s still not reading the ‘add_holidays’ values. :face_with_raised_eyebrow: :rage:

It looks like that sensor is just real wonky. After looking around, I found this thread detailing similar problems with the sensor that ended in multiple people recommending to just set up a similar sensor manually, with explanations of how to do so.

1 Like

As counter-intuitive as it may seems, you have to explicitly exclude holidays:

- platform: workday
  name: Workday_Tomorrow
  days_offset: 1
  country: US
  province: PA
  add_holidays:
    - "2021-11-25"
    - "2021-11-26"
    - "2021-12-23"
    - "2021-12-24"
    - "2021-12-25"
    - "2021-12-31"    

EDIT: Your workdays and excludes should be default, basically.

1 Like

Thanks, that looks to be working. I’m going to do some testing to make sure it does what I want.

The documentation does not represent the actual functionality, as the examples do not work correctly.

Thanks for the assistance.

The first example in the docs shows that including holidays in exclude is for the base holidays, not custom holidays. And, anyway, neither config seemed to work for the OP.

1 Like

Well, code doesn’t lie :wink:
Standard holidays and custom holidays are merged, so that 1st example in doc is wrong, indeed.

EDIT:

2 Likes

It seems to be working, but if I understand, it would have a problem if I worked non-standard days (e.g. other than M-F) as I couldn’t set the holidays once I set the workdays or excludes.

Yes, you can. You have to add “holiday” to your excludes to actually exclude holidays from working days.

    workdays: [wed, thu, fri, sat, sun]
    excludes: [mon, tue, holiday]

Alright, just glad that I was reading things correctly :laughing: and I see now that I must’ve misinterpreted the OP’s responses:

Bit of a confusing chain…

Not sure how the OP tested Friday, unless he actually changed the date on his HA instance :wink:
Arf, he just changed the offset I suppose :roll_eyes: