binary_sensor:
- platform: workday
country: your country code
province: your province code
The sensor’s default is all weekdays are workdays (sensor will indicate on) and all other days (weekends and holidays) are not (sensor indicates off).
Your condition needs to implement the following logic:
(temp < 21) AND
(
((workday = on) AND (5:15 < time < 22:15)) OR
((workday = off) AND (8:15 < time < 22:15))
)
Try this:
- id: 'Week'
alias: Week
trigger:
- platform: numeric_state
entity_id: sensor.hz_temp
below: 21
- platform: time
at: '05:15:01'
- platform: time
at: '08:15:01'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.hz_temp
below: 21
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'on'
- condition: time
after: '05:15:00'
before: '22:15:00'
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'off'
- condition: time
after: '08:15:00'
before: '22:15:00'
action:
- device_id: b379fb57788d44baa998b6a5a4589835
domain: switch
entity_id: switch.heater
type: turn_on