dariusz
September 25, 2019, 11:26am
1
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]
tom_l
September 25, 2019, 11:54am
2
dariusz:
I need other automation, but operating on ‘holiday’ days, i.e. ‘sat, sun, holiday’.
This should do it:
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'off' #<------ Not workday, thus = holiday!
dariusz
September 25, 2019, 11:58am
3
Really…? So simple?
Means ‘off’ on workdays and ‘on’ on ‘sat, sun, holidays’ ?
tom_l
September 25, 2019, 12:14pm
4
Other way round but yes. That simple.
on = workday
off = holiday or sat or sun.
Markus99
(Mark)
September 25, 2019, 12:31pm
5
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
123
(Taras)
September 25, 2019, 1:02pm
7
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.
The binary sensor currently returns true or false. It would be awesome if it could also include an attribute ‘holiday’ with the name of the holiday, if any, or ‘unknown’ or empty when not. This attribute could then be extracted with a template sensor for display purposes in the front end, for notifications and automation.