Franck Nijhof c464056402
Making our website faster, cleaner and prettier (#9853)
* 🔥 Removes octopress.js

* 🔥 Removes use of root_url var

* 🔥 Removes Octopress generator reference from feed

* 🔥 Removes delicious support

* 🔥 Removes support for Pinboard

* 🔥 Removes support for Disqus

* 🔥 Removes support for Google Plus

* ↩️ Migrate custom after_footer to default template

* ↩️ Migrate custom footer to default template

* ↩️ Migrate custom header to default template

* 🔥 Removes unused template files

* 🚀 Places time to read directly in post template

* 🚀 Removes unneeded capture from archive_post.html template

* 🔥 🚀 Removes unused, but heaving sorting call in component page

* 🚀 Merged javascripts into a single file

* 🔥 Removes more uses of root_url

* 🚀 Removal of unneeded captures from head

* 🔥 🚀 Removal of expensive liquid HTML compressor

* 🔥 Removes unneeded templates

* 🚀 Replaces kramdown with GitHub's CommonMark 🚀

* 💄 Adds Prism code syntax highlighting

*  Adds support for redirect in Netlify

* ↩️ 🔥 Let Netlify handle all developer doc redirects

* ✏️ Fixes typo in redirects file: Netify -> Netlify

* 🔥 Removes unused .themes folder

* 🔥 Removes unused aside.html template

* 🔥 Removes Disqus config leftover

* 🔥 Removes rouge highlighter config

* 🔥 Removes Octopress 🎉

* 💄 Adjust code block font size and adds soft wraps

* 💄 Adds styling for inline code blocks

* 💄 Improve styling of note/warning/info boxes + div support

* 🔨 Rewrites all note/warning/info boxes
2019-07-15 22:17:54 +02:00

3.2 KiB

title, description, logo, ha_category, ha_iot_class, ha_release, ha_qa_scale, redirect_from
title description logo ha_category ha_iot_class ha_release ha_qa_scale redirect_from
Workday Binary Sensor Steps to configure the binary workday sensor. home-assistant.png
Utility
Local Polling 0.41 internal
/components/binary_sensor.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 uses the python module holidays to incorporate information about region-specific public holidays.

Setup

Check the country list for available province.

Configuration

To enable the workday sensor in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
binary_sensor:
  - platform: workday
    country: DE

{% configuration %} name: description: A name for this sensor. required: false type: string default: Workday Sensor country: description: > Country code according to holidays notation. required: true type: string province: description: Province code according to holidays notation. required: false type: string workdays: description: List of workdays. required: false type: list default: "[mon, tue, wed, thu, fri]" excludes: description: List of workday excludes. required: false type: list default: "[sat, sun, holiday]" days_offset: description: Set days offset (e.g., -1 for yesterday, 1 for tomorrow). 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.

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. 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.

Full example

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

# 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'

Automation example

Example usage for automation:

automation:
  alias: Turn on heater on workdays
  trigger:
    platform: time
    at: '08:00:00'
  condition:
    condition: state
    entity_id: 'binary_sensor.workday_sensor'
    state: 'on'
  action:
    service: switch.turn_on
    entity_id: switch.heater

Please remember that as explained here you can only have a single automation: entry. Add the automation to your existing automations.