2.6 KiB
title, description, ha_category, ha_iot_class, ha_release, ha_quality_scale, ha_config_flow, ha_codeowners, ha_domain, ha_platforms, ha_integration_type
title | description | ha_category | ha_iot_class | ha_release | ha_quality_scale | ha_config_flow | ha_codeowners | ha_domain | ha_platforms | ha_integration_type | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Workday | Steps to configure the binary workday sensor. |
|
Local Polling | 0.41 | internal | true |
|
workday |
|
integration |
The workday
binary sensor indicates whether the current day is a workday or not. It allows specifying which days of the week will count as workdays and also
uses the Python module holidays to incorporate information about region-specific public holidays.
This can be used to make automations that act differently on weekdays vs weekends. For example, you could make your bedroom lights turn on (gently) at 7 in the morning if it is a weekday, but wait until 11 if it is a weekend day.
Setup
Check the country list for available provinces (and other subdivisions, like states and territories) for each country.
{% include integrations/config_flow.md %}
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.
Watch how the holiday
keyword is used. Your first instinct might be adding it to the exclude
configuration, thinking it means skipping the holidays. It means to exclude the days in the holiday list from the workdays. So, when you exclude holiday
and a workday falls on that day, that workday is excluded, and the sensor will be off. If you want every workday flagged with no regard to holidays, ensure that there is something in your Excludes
configuration other than holiday
.
Specific field information
Country code must be given according to holidays notation.
Subdivision code must be given according to holidays notation.
Add holidays will only take dates formatted with YYYY-MM-DD
.
Remove holidays will take dates formatted with YYYY-MM-DD
or partial of name, for example, christmas
will exclude Christmas Day
.
The offset can be used to see if future days are workdays. For example, put 1
to see if tomorrow is a workday.
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
target:
entity_id: switch.heater