And condition confusion

Hi,

I’m probably missing something really stupid here, but I’ve been looking at this automation and I can’t for the life of me work out what’s wrong.

I’m having some weird behavior with an ‘and’ condition, which seems to be being triggered when neither of the inputs is true. The rule in question looks like this:

- alias: 'Light off in morning (workdays)'
  trigger:
    platform: time
    at: '07:30:00'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: binary_sensor.workday_sensor
        state: 'on'
      - condition: state
        entity_id: input_boolean.on_holiday
        state: 'off'
  action:
    - service: light.turn_off
      data:
        entity_id: light.hallway_light

Basically, this automation should be executed only on days when I’m working, by checking that both workday_sensor is on and that on_holiday is off. Currently, workday_sensor is on and on_holiday is also on, but the automation was executed at 7.30 this morning.

Anyone have any idea what I’m missing here?

The automation condition examples show the entity_ids in single quotes. I don’t know if that matters, or not.

conditions:
      - condition: state
        entity_id: 'binary_sensor.workday_sensor'
        state: 'on'
      - condition: state
        entity_id: 'input_boolean.on_holiday'
        state: 'off'

I’ve had cases where an automation would run if one or more of the template sensors used in the conditions didn’t have any value or was “null” at the time of trigger.

I dont think the quotes matter. I don’t use them for entities.