From 79bdc01c4c2ad0fb9cd4407abf06f2e6170c4ef9 Mon Sep 17 00:00:00 2001 From: Peter Epley Date: Sat, 9 Mar 2019 13:25:34 -0500 Subject: [PATCH 1/2] Add custom holidays to workday sensor --- source/_components/binary_sensor.workday.markdown | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/_components/binary_sensor.workday.markdown b/source/_components/binary_sensor.workday.markdown index 75cd8c6e2719..e3022acaca8d 100644 --- a/source/_components/binary_sensor.workday.markdown +++ b/source/_components/binary_sensor.workday.markdown @@ -31,6 +31,7 @@ binary_sensor: - platform: workday country: DE workdays: [mon, wed, fri] + add_holidays: ['2018-12-26','2018-12-31'] ``` {% configuration %} @@ -63,12 +64,18 @@ days_offset: required: false type: integer default: 0 +add_holidays: + description: Add custom holidays (such as company, personal holidays, or vacations). + 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. +Custom holidays must be formatted as ['yyyy-mm-dd'] with commas separating each date to be added. +

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`. @@ -98,4 +105,3 @@ automation:

Please remember that [as explained here](/docs/configuration/devices/) you can only have a single `automation:` entry. Add the automation to your existing automations.

- From 441751d4d122117400e765ffda680b6c77fb760d Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 10 Mar 2019 15:53:05 +0100 Subject: [PATCH 2/2] Keep configuration sample minimal --- .../binary_sensor.workday.markdown | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/source/_components/binary_sensor.workday.markdown b/source/_components/binary_sensor.workday.markdown index e3022acaca8d..d21550d0d92c 100644 --- a/source/_components/binary_sensor.workday.markdown +++ b/source/_components/binary_sensor.workday.markdown @@ -30,8 +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] - add_holidays: ['2018-12-26','2018-12-31'] ``` {% configuration %} @@ -65,16 +63,13 @@ days_offset: type: integer default: 0 add_holidays: - description: Add custom holidays (such as company, personal holidays, or vacations). + 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. - -Custom holidays must be formatted as ['yyyy-mm-dd'] with commas separating each date to be added. +The keyword `holiday` is used for public holidays identified by the holidays module.

If you use the sensor for Norway (`NO`) you need to wrap `NO` in quotes or write the name in full. @@ -83,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.

+## {% 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: