Condition with input boolean not working

I have an automation that does some clean-up when I leave the house, which involves resetting an input boolean “SE Bedroom Bed Occupied”. For some reason, this condition failed today, even though logically it should have triggered. Any ideas on how to debug it?

According to the trace, the condition evaluated to false because the input boolean’s state was “off”.

However, looking at the history of the input boolean, it was “on” at the time (7:50 AM).

The full automation is shown below. I also manually validated the condition works using the “Test” feature, so I don’t understand why it didn’t work on its own.

alias: On leave - Karan
description: ""
trigger:
  - platform: state
    entity_id:
      - person.karan
    from: home
    to: not_home
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition: []
action:
  - service: script.turn_off_aux_lights_in_bedroom
    data: {}
  - type: turn_off
    device_id: e8bd9dd05ea9df26c23ed2db3e31aadc
    entity_id: switch.plug_2
    domain: switch
  - type: turn_off
    device_id: ff0d2e2406dae2ccbdf4abad696b00ef
    entity_id: switch.bedroom_light
    domain: switch
  - type: turn_off
    device_id: a8476e2f96d461ef3403fa91bb285b83
    entity_id: 0f3be70dcabf1918d81d32298a45d864
    domain: switch
  - if:
      - condition: state
        entity_id: input_boolean.se_bedroom_bed_occupied
        state: "on"
    then:
      - service: script.toggle_se_bedroom_bed_occupancy
        data: {}
mode: single

The first screenshot shows the automation’s trace steps on October 12.

The second screenshot shows the Input Boolean’s history for October 13-14.

Ahh thanks, it looks like the automation didn’t trigger this morning in the first place, so that was an old trace. Will need to look into the device trackers I set.

1 Like