Automation based on 'holiday" days

I have ‘automation’ using ‘binary_sensor.workday_sensor’ which is doing some activity on working days.

# Enable workday info
binary_sensor:
  - platform: workday
    country: xx
- condition: state
    entity_id: binary_sensor.workday_sensor
    state: 'on'

However I need other automation, but operating on ‘holiday’ days, i.e. ‘sat, sun, holiday’.
How that can be done using parameters of ‘binary_sensor.workday_sensor’ ?
I’ve tried - but not getting results…

Will that work if I use ‘workdays’ as ‘mon, tue, wed, thu, fri, sat, sun’ and then use ‘excludes’ ‘mon, tue, wed, thu, fri’ ?

workdays

(list)(Optional)

List of workdays.

Default value:

[mon, tue, wed, thu, fri]

excludes

(list)(Optional)

List of workday excludes.

Default value:

[sat, sun, holiday]

This should do it:

- condition: state
    entity_id: binary_sensor.workday_sensor
    state: 'off'  #<------ Not workday, thus = holiday!

Really…? So simple?
Means ‘off’ on workdays and ‘on’ on ‘sat, sun, holidays’ ?

Other way round but yes. That simple.

on = workday
off = holiday or sat or sun.

This is my workday sensor, as setup in sensor_binary.yaml called from an !include in configuration.yaml:

- 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'

Default is ‘on’ unless it matches an ‘excludes’ (weekends & defined add_holidays)

Hope this helps!

1 Like

O.K. Thank you…

You may wish to vote for this Feature Request so that when it’s a holiday (workday binary_sensor is off) you’ll know which holiday it is.