Workday sensor failed this morning - can't understand why?

I discovered & set up the workday sensor last week and I use the state of this binary sensor as a condition in an automation which turns on my office heater in the morning as I WFH. Previously I was using an input boolean linked to a button on my dashboard which required me to remember the night before.

The workday sensor was working fine for a few days, stayed off over the weekend and was on again yesterday (Monday), however this morning (Tuesday, 2021-11-30) it switched to off and I’ve no idea why. I have restarted my HA container and it’s still has a state of ‘off’ rather than ‘on’.

Can anyone help me debug why?

  - platform: workday
    country: UK
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - "2021-12-21"
      - "2021-12-22"
      - "2021-12-23"
      - "2021-12-24"
      - "2021-12-28"
      - "2021-12-29"
      - "2021-12-30"
      - "2021-12-31"
      - "2022-06-06"
      - "2022-06-07"
      - "2022-06-08"
      - "2022-06-09"
      - "2022-06-10"
      - "2022-08-15"
      - "2022-08-16"
      - "2022-08-17"
      - "2022-08-18"
      - "2022-08-19"

This is because your country is set to ‘UK’, but (I assume) you live in England. Today is St. Andrew’s day in Scotland, which is causing today to be classed as a holiday by the sensor for the whole UK.

You can fix it by changing your country to simply ‘England’. In fact, your config can be significantly smaller, and still function - this is mine:

  - platform: workday
    country: England
    workdays: [mon, tue, wed, thu, fri]

I believe it is because today is St Andrew’s Day in Scotland where it is a public holiday and since all holidays from UK member countries would be included in holidays and your add_holidays does not override existing holidays then technically the workday sensor for today is acting correctly. You would need to add a remove_holidays section to exclude holidays that you don’t want to be considered as holidays

Doh! Many thanks. I actually work with a few Scots but they work St Andrews Day, however it is in my work calendar sitting there staring at me but it never registered.

Changed UK > England and restarted and it’s back to the correct status, many thanks.

I am curious if your workday sensor is still working after upgrading to the latest release 2022.3 ?

Initially it broke but when I looked at my logs I could see that the workday config has changed for “provinces”, here’s my updated yaml:

  - platform: workday
    country: GB
    province: England
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - "2022-04-12"

Previously I had England specified as my country, now it’s a province of the country GB.