Skip to content

Commit bcc9d70

Browse files
epleypafabaff
authored andcommitted
Add custom holidays to workday sensor (home-assistant#8887)
* Add custom holidays to workday sensor * Keep configuration sample minimal
1 parent 3df9f52 commit bcc9d70

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

source/_components/binary_sensor.workday.markdown

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ To enable the `workday` sensor in your installation, add the following to your `
3030
binary_sensor:
3131
- platform: workday
3232
country: DE
33-
workdays: [mon, wed, fri]
3433
```
3534
3635
{% configuration %}
@@ -63,11 +62,14 @@ days_offset:
6362
required: false
6463
type: integer
6564
default: 0
65+
add_holidays:
66+
description: "Add custom holidays (such as company, personal holidays or vacations). Needs to formatted as `YYYY-MM-DD`."
67+
required: false
68+
type: list
6669
{% endconfiguration %}
6770

6871
Days are specified as follows: `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`.
69-
The keyword `holiday` is used for public
70-
holidays identified by the holidays module.
72+
The keyword `holiday` is used for public holidays identified by the holidays module.
7173

7274
<p class='note warning'>
7375
If you use the sensor for Norway (`NO`) you need to wrap `NO` in quotes or write the name in full.
@@ -76,6 +78,22 @@ If you use the sensor for Canada (`CA`) with Ontario (`ON`) as `province:` then
7678
Otherwise the value is evaluated as `true` (check the YAML documentation for further details) and the sensor will not work.
7779
</p>
7880

81+
## {% linkable_title Full example %}
82+
83+
This examples excludes Saturdays, Sundays and holiday. Two custom holidays are added.
84+
85+
```yaml
86+
# Example configuration.yaml entry
87+
binary_sensor:
88+
- platform: workday
89+
country: DE
90+
workdays: [mon, wed, fri]
91+
excludes: [sat, sun, holiday]
92+
add_holidays:
93+
- '2018-12-26'
94+
- '2018-12-31'
95+
```
96+
7997
## {% linkable_title Automation example %}
8098

8199
Example usage for automation:
@@ -98,4 +116,3 @@ automation:
98116
<p class='note'>
99117
Please remember that [as explained here](/docs/configuration/devices/) you can only have a single `automation:` entry. Add the automation to your existing automations.
100118
</p>
101-

0 commit comments

Comments
 (0)