Workday sensor: State of next day?

How can I get the state of the workday sensor for the next day?
Actually I turn off a light earlier when the next day is a working day (Sunday to Thursday) and later when it is Friday or Saturday. It works fine during a normal week - but it doesn’t takes into account public holidays. Is there may be a solution with the workday sensor?

## Schrank aus werktags  
- alias: Schrankbel aus Werktag
  trigger:
    platform: time
    at: '22:45:00'
  condition:
    condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - sun
  action:
    service: light.turn_off
    entity_id: light.schrank

# Schrank aus Wochenende
- alias: Schrankbel aus Wochenende
  trigger:
    platform: time
    at: '23:20:00'
  condition:
    condition: time
    weekday:
    - fri
    - sat
  action:
    service: light.turn_off
    entity_id: light.schrank

Thanks!

Yes. That’s what the days_offset option is for. Define a workday sensor with that set to 1, which will indicate if tomorrow is a workday. Then you can use that sensor in the condition of your automations.

3 Likes

Apologies for the necromancy.

Is it known if configuring the second sensor will reference the add_holidays and remove_holidays from a previous entry?

Alternate phrasing: Do multiple instances of the same binary_sensor like this, use an aggregate data set, or individual?

I will be testing this, but if someone knows a definitive answer, that would be excellent.

Edit
Looks like its a fully individual instance (not surprising).

binary_sensor:
  # https://www.home-assistant.io/integrations/workday/
  - name: workday_today_sensor
    platform: workday
    country: US
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun]
    add_holidays: []
    remove_holidays: []
  - name: school_night_sensor
    days_offset: 1
    platform: workday
    country: US

Results in school_night_sensor having the default for excludes of [sat, sun, holiday] even though its defined and omitted from workday_today_sensor.

image

1 Like

It would be extremely helpful if an attr_days_offset would be an option that could be shown as an attribute…and allow multiple instances. 1 day offset for tomorrow. 3 day offset for Monday when it’s Friday, etc.