home-assistant.io/source/_components/binary_sensor.workday.markdown
Kip 9b475c11f2 Corrected example, condition state on (#2342)
Sensor in 'on' for workday, 'off' for non-workday. Corrected automation example to reflect that.
2017-03-27 20:41:46 +02:00

1.6 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, ha_iot_class, ha_release
layout title description date sidebar comments sharing footer logo ha_category ha_iot_class ha_release
page Workday Binary Sensor Steps to configure the binary workday sensor. 2017-03-13 21:30 true false true true home-assistant.png Binary Sensor Local Polling 0.41

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.

# Example configuation.yaml entry
binary_sensor:
  - platform: workday
    country: DE
    province: BW

Configuration variables:

  • country (Required): Country code according to holidays notation.
  • province (Optional): Province code according to holidays notation (defaults to None).
  • workdays (Optional): List of workdays (defaults to mon, tue, wed, thu, fri).
  • excludes (Optional): List of workday excludes (defaults to sat, sun, holiday).

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.

Example usage for automation:

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