Trying to extract the state of my lock to a binary sensor

Make sure your code is under binary_sensors: NOT sensors:
Your lock state will return locked or unlocked, which is not a valid state for a binary_sensor (on/off)
You therefore need to adjust your template as such (assuming on means unlocked here, amend as necessary)

 - platform: template
    sensors:
      lock_frontdoor:
        friendly_name: "Hoveddør lås"
        device_class: lock
        value_template: "{{ states('lock.poly_control_danalock_v3_btze_locked') == 'unlocked' }}"
1 Like