Why does this automation not work?

Hi,

I’m struggling to get an automation working. It doesn’t start up when I lock my frontdoor (“voordeur” in Dutch). Any ideas how to solve this?

I’m suspecting that the locking of the frontdoor is not known by HA and therefor nothing will happen.

alias: Melding rico's raam staat open bij afwezigheid of vergrendelde voordeur
description: ""
trigger:
  - platform: state
    entity_id:
      - device_tracker.sander
      - device_tracker.josine
    to: not_home
  - platform: state
    entity_id:
      - lock.voordeur
    to: locked
condition:
  - type: is_open
    condition: device
    device_id: dc42546ea1a806c0afede5917b45841d
    entity_id: binary_sensor.raamsensor_rico
    domain: binary_sensor
action:
  - service: notify.mobile_app_sander
    data:
      message: Rico's raam staat open!
mode: single

Do you see the entity for the lock in the dev tools states list? And if so does it change states (unlocked to locked and back) as expected?

Also what does the automation trace tell you about the automation?

Is device_id: dc42546ea1a806c0afede5917b45841d a binary sensor?
I thought that binary _sensor has states ‘on’ and ‘off’ rather than ‘is_open’ or ‘is_closed’, so perhaps condition is never met? What is state shown in developer tools?
Why do you refer to devices for checking conditons instead of related entities?

It appears my wifi connection wasn’t working correctly. I managed to get this one working.

Thanks for the reactions!

When using a Device condition it is normal for binary sensors with door, window, and cover device classes to have ‘is_open’ or ‘is_closed’ as their type.

I use the configurator and it’s using these two as a default choises. Can’t go wrong, I think.