Skip to content

Add custom holidays to workday sensor #8887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions source/_components/binary_sensor.workday.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ To enable the `workday` sensor in your installation, add the following to your `
binary_sensor:
- platform: workday
country: DE
workdays: [mon, wed, fri]
```

{% configuration %}
Expand Down Expand Up @@ -63,11 +62,14 @@ days_offset:
required: false
type: integer
default: 0
add_holidays:
description: "Add custom holidays (such as company, personal holidays or vacations). Needs to formatted as `YYYY-MM-DD`."
required: false
type: list
{% endconfiguration %}

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

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

## {% linkable_title Full example %}

This examples excludes Saturdays, Sundays and holiday. Two custom holidays are added.

```yaml
# Example 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'
```

## {% linkable_title Automation example %}

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