mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-17 06:16:50 +00:00
Add custom holidays to workday sensor (#8887)
* Add custom holidays to workday sensor * Keep configuration sample minimal
This commit is contained in:
parent
3df9f52770
commit
bcc9d705ee
@ -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 %}
|
||||
@ -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.
|
||||
@ -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:
|
||||
@ -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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user