Work day fix (#12124)

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update source/_integrations/workday.markdown

Co-Authored-By: Franck Nijhof <frenck@frenck.nl>

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update workday.markdown

* Update source/_integrations/workday.markdown

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
This commit is contained in:
Paul Enright 2020-03-10 09:32:23 -05:00 committed by GitHub
parent 142b819b89
commit c56e7e7c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ ha_codeowners:
ha_domain: workday
---
The `workday` binary sensor indicates, whether the current day is a workday or not. It allows specifying, which days of the week counts as workdays and also
The `workday` binary sensor indicates, whether the current day is a workday or not. It allows specifying, which days of the week will count as workdays and also
uses the Python module [holidays](https://pypi.python.org/pypi/holidays) to incorporate information about region-specific public holidays.
## Setup
@ -19,7 +19,6 @@ uses the Python module [holidays](https://pypi.python.org/pypi/holidays) to inco
Check the [country list](https://github.com/dr-prodigy/python-holidays#available-countries) for available province.
## Configuration
To enable the `workday` sensor in your installation, add the following to your `configuration.yaml` file:
```yaml
@ -71,26 +70,40 @@ The keyword `holiday` is used for public holidays identified by the holidays mod
<div class='note warning'>
If you use the sensor for Norway (`NO`) you need to wrap `NO` in quotes or write the name in full.
Otherwise the value is evaluated as `false`.
Otherwise, the value is evaluated as `false`.
If you use the sensor for Canada (`CA`) with Ontario (`ON`) as `province:` then you need to wrap `ON` in quotes.
Otherwise the value is evaluated as `true` (check the YAML documentation for further details) and the sensor will not work.
Otherwise, the value is evaluated as `true` (check the YAML documentation for further details) and the sensor will not work.
One other thing to watch is how the `holiday` keyword is used. Your first instinct might be to add it to the `exclude` configuration, thinking that it means to skip the holidays. Actually it means to exclude the days in the holidays list from the workdays. So when you exclude `holiday` and a workday falls on that day, then that workday is excluded. Meaning the sensor will be off. If you want the workday flagged without regarding holidays, make sure that there is something in your `Excludes` configuration other than `holiday`.
</div>
## Full example
## Full examples
This examples excludes Saturdays, Sundays and holiday. Two custom holidays are added.
This example excludes Saturdays, Sundays but not a holiday. Two custom holidays are added.
Even though `sat` and `sun` was not included in `workdays` and in theory, it would not need to be excluded, but because we do not what holidays excluded, we add them so exclude would not default and skip the holidays. Therefore as the note above, 2/17/2020 in the US would still be a workday.
```yaml
# Example configuration.yaml entry
# Example 1 configuration.yaml entry
binary_sensor:
- platform: workday
country: US
workdays: [mon, tue, wed, thu, fri]
excludes: [sat, sun]
```
This example excludes Saturdays, Sundays and holidays. Two custom holidays are added.
The date February 24th, 2020 is a Monday but will be excluded because it was added to the `add_holiday` configuration.
```yaml
# Example 2 configuration.yaml entry
binary_sensor:
- platform: workday
country: DE
workdays: [mon, wed, fri]
excludes: [sat, sun, holiday]
add_holidays:
- '2018-12-26'
- '2018-12-31'
- '2020-02-24'
```
## Automation example