add variable to remove holidays from workday sensor (#15284)

This commit is contained in:
Peter Epley 2020-11-10 04:27:11 -05:00 committed by GitHub
parent 54e9eafbe9
commit 1d7f674d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,6 +63,10 @@ add_holidays:
description: "Add custom holidays (such as company, personal holidays or vacations). Needs to formatted as `YYYY-MM-DD`."
required: false
type: list
remove_holidays:
description: "Remove holidays (treat holiday as workday). Needs to formatted as `YYYY-MM-DD`."
required: false
type: list
{% endconfiguration %}
Days are specified as follows: `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`.
@ -107,6 +111,20 @@ binary_sensor:
- '2020-02-24'
```
This example excludes Saturdays, Sundays and holidays. Two holidays are removed: November 26, 2020 and December 25, 2020.
```yaml
# Example 2 configuration.yaml entry
binary_sensor:
- platform: workday
country: US
workdays: [mon, tue, wed, thu, fri]
excludes: [sat, sun, holiday]
remove_holidays:
- '2020-11-26'
- '2020-12-25'
```
## Automation example
Example usage for automation: