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.
Check the country list for available province.
To enable the
workday sensor in your installation, add the following to your
# Example configuration.yaml entry binary_sensor: - platform: workday country: DE workdays: [mon, wed, fri]
- name (Optional): A name for this sensor. Defaults to Workday Sensor
- 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
excludes (Optional): List of workday excludes. Defaults to
days_offset (Optional): Set days offset. Defaults to
Days are specified as follows:
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
NOin quotes or write the name in full. Otherwise the value is evaluated as
If you use the sensor for Canada (
CA) with Ontario (
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.
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