Workday Sensor didnt work in automation

Hey Guys,
i set in my configuration.yaml this

binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]

After this i create a shutter automation where the workday sensor is a condition.

condition: state
entity_id: binary_sensor.workday_sensor
attribute: workdays
state: "On"

When i look on my info, i see that the sensor work correct.

When i test the condition under the automation i became the error:
Condition did not pass.

And the shutter automation dont work.

Can someone tell me wheres the issue?

Remove attribute from the condition.

2 Likes

Precisely, the workday sensor is On at workdays, Off otherwise.

Also: You could simplify your configuration by adding your province (Bundesland) to the configuration, one of BB, BE, BW, BY, BYP, HB, HE, HH, MV, NI, NW, RP, SH, SL, SN, ST, TH. This way the workday sensor will be Off on national and regional holidays. No need to exclude weekends and holiday anymore.

binary_sensor:
  - platform: workday
    country: DE
    province: NW
1 Like

Where did this province settings take the infos?

i loaded at the moment the HACS Holidays AddOn

When i test this condition without an attribute:
Condition did not pass

It’s a binary_sensor entity so its nominal states are on and off not On and Off.

condition:
  - condition: state
    entity_id: binary_sensor.workday_sensor
    state: "on"
1 Like

Check the country list for available provinces (and other subdivisions, like states and territories) for each country.

Then you’re doing it wrong. I do also automate the blinds depending on workday sensor:

  • I raise them later in the morning, on weekends and holidays
  • I close them later in the evening, if the next day is a weekend day or a holiday

From my configuration.yaml

binary_sensor:
  - platform: workday
    name: workday_today
    country: DE
    province: NW

From my automations.yaml:

- alias: open covers
  trigger:
  - at: 07:15:00
    platform: time
  - at: 09:30:01
    platform: time
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.workday_today
      state: 'on'
    - after: 09:30:00
      condition: time
  action:

As you can see (maybe this is relevant), the state is ‘on’, not ‘On’. Blinds will open 7:30am on workdays, 9:30h off workdays.

This is crazy… when i click on on the state selection field there is also an upper letter On. But now this passed.

The UI translates states for the user. Under the hood, states are all in English and lowercase. In the frontend, it will be the translation to your language and shown as a title.

Thank you.