After restarts, automations stop working

After any recent restarts of my Yellow, the automations for my August lock and Unifi Doorbell break.
I think it’s because the device-id’s change? Is there a better way to define the devices?

alias: "Doorbell NFC scan, un/locks August deadbolt. "
description: ""
triggers:
  - trigger: webhook
    allowed_methods:
      - POST
      - PUT
    local_only: true
    webhook_id: "*redacted*"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: device
            device_id: a6889ef403156e4bca15f6953070cfa8
            domain: lock
            entity_id: a99f84e1f227d40c11d646f7b1d7e3bd
            type: is_locked
        sequence:
          - device_id: a6889ef403156e4bca15f6953070cfa8
            domain: lock
            entity_id: a99f84e1f227d40c11d646f7b1d7e3bd
            type: unlock
      - conditions:
          - condition: device
            device_id: a6889ef403156e4bca15f6953070cfa8
            domain: lock
            entity_id: a99f84e1f227d40c11d646f7b1d7e3bd
            type: is_unlocked
          - type: is_not_open
            condition: device
            device_id: a6889ef403156e4bca15f6953070cfa8
            entity_id: 6dcff2ea01ca2fec81e64b3c7a70294e
            domain: binary_sensor
            enabled: false
        sequence:
          - device_id: a6889ef403156e4bca15f6953070cfa8
            domain: lock
            entity_id: a99f84e1f227d40c11d646f7b1d7e3bd
            type: lock
    enabled: true
    default:
      - device_id: a6889ef403156e4bca15f6953070cfa8
        domain: lock
        entity_id: a99f84e1f227d40c11d646f7b1d7e3bd
        type: unlock
mode: single

Yep, simply don’t use devices for Automations.

I’ll give this a try. Thank you.

1 Like