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
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.
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.
From the 2023.5 release it is very easy to define a “Workday tomorrow”-sensor in the UI. Go to settings and add a new workday sensor and set the offset to 1. Done
As a Home Assistant beginner, while not directed at you personally, this is a point of frustration. I’ve gone down multiple paths and rabbit holes without success.
It’s easy in the UI, I think, based on experience. HOW do you add in the UI? There are many areas in Settings, of course. I haven’t had any luck trying this in Helpers, etc.
Workday is an integration. So you have to go to settings → devices & services → add integration (at the bottom right).
Then enter workday and it should show you the integration. When entered your country you can edit the preffered settings.
That’s easy indeed. Unfortunately it results in a double (custom) holiday administration if one wants to know if today is a workday and if tomorrow is a workday.
For example, I have morning automations that use the workday sensor and I’d like to use it in the evening for the same reason as the topic starter mentioned.
I currently solved this by using a helper. At 1s before midnight it sets the helper to the state of tomorrow if it’s different. It however would be lovely to have an .AddDays(n) option.
Anyway, does anyone happen to have a better solution than my helper solution?
In the same boat over here… Not happy with maintaining two workday calendars (School Day Today, School Day Tomorrow) especially since sometimes schedules change and then one has to make modifications in two places.
If it was possible to check Tomorrow as an attribute of Today that would be great.
Another solution would be to break out the custom holidays and have them as objects referenced by the custom Workday sensors…
That way you could have highly customizable Workday sensors AND the benefit of maintaining calendars in one place.