#automation for binary_sensor not firing

1 messages · Page 1 of 1 (latest)

ocean stone
#

Hi, I am trying to get an automation working for a binary_sensor door contact I have. Even though I see the status changing from "Open" to "Closed" in home assistant, this automation is not firing. The only thing that seems suspect to me is that the "to" field has Open instead of on/off, but that's what the HA UI has in the dropdown box for the status.

alias: Front Door Open Too Long
description: ""
triggers:
  - entity_id:
      - binary_sensor.front_door_contact
    to: Open
    for:
      hours: 0
      minutes: 1
      seconds: 0
    trigger: state
    from: null
conditions: []
actions:
  - data:
      message: ":red_square: The Front Door has been open for over a minute."
      target:
        - "redacted"
    action: notify.grace_hollow_home_assistant
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
    enabled: true
mode: restart
lunar tangle
#

Check the entity in the developertools. The correct state is on/off

ocean stone
#

The HA UI won't let me put "off", it only lets me pick from the dropdown and it won't let me put "off" in there and save.

#

I will try it in yaml editor mode and see if it lets me save, but that seems like a UX glitch

lunar tangle
#

That's correct, in the yaml it's on/off though

ocean stone
#

I didn't manually put Open and Closed in the yaml, I just went into the yaml editor to get the yaml definition to paste it in here for you guys to help me -- weirdly enough though, when I went back into yaml editor to then make the change manually, it now says "off" instead of Closed 👻

#

I will re-test, thank you!

ocean stone
#

weirdly, it did not fire.

#

current yaml:

alias: Front Door Open Too Long
description: ""
triggers:
  - entity_id:
      - binary_sensor.front_door_contact
    to: "off"
    for:
      hours: 0
      minutes: 1
      seconds: 0
    trigger: state
    from: null
conditions: []
actions:
  - data:
      message: ":red_square: The Front Door has been open for over a minute."
      target:
        - "1062527355500896359"
    action: notify.grace_hollow_home_assistant
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
    enabled: true
mode: restart
#

The developer tools show the yaml attributes as:

battery: 100
contact: true
device_temperature: 25
last_seen: "2025-07-23T17:25:19.398Z"
linkquality: 255
power_outage_count: 26
trigger_count: 12
voltage: 3015
device_class: door
friendly_name: Front Door Door
#

I wonder if I have off/on true/false open/closed reversed somehow

terse trellis
winged breach
#

The from: null should not be there in the trigger. remove the entire line.