Make Binary Sensor Appear as Lock?

I’ve converted a binary sensor to a lock using this binary sensor template

      back_door_lock:
        friendly_name: "Back Door"
        device_class: lock
        value_template: >-
         {{ is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_ce212304_on_off', 'off') }}

Trouble is the domain appears as ‘binary_sensor’ I need it show as lock.

I tried to use the lock template but can’t get it to validate as there is not service called when a binary sensor changes state.

lock:
  - platform: template
    name: Garage door
    value_template: "{{ is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_ce212304_on_off', 'off') }}"
    lock:
      service: ???
      data:
        entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_ce212304_on_off
    unlock:
      service: ???
      data:
        entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_ce212304_on_off

Any ideas?

1 Like

What do you do now to lock und unlock the door?

Why do you need the domain to be a lock?

It’s a dumb lock where I just detect the lock state using a binary sensor

I need it to be the lock domain as the addon i’m using requires it to show as a lock domain

I have tried that but couldn’t get it to work as there is no corresponding service I can use.

What add-on are you using that requires a lock?

Dwains theme

Change the device class to lock. Go to settings (make sure you have advanced mode on) there you see customize option. Select your binary_sensor entity and edit the device class to lock.

Or are you trying to achieve something else?

Make a dummy script.

script:
  dummy:
    sequence:
      delay: "00:00:00"

and a template lock

lock:
  - platform: template
    name: Garage door
    value_template: "{{ is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_ce212304_on_off', 'off') }}"
    lock:
      service: script.dummy
    unlock:
      service: script.dummy
4 Likes

Already tried that

      back_door_lock:
        friendly_name: "Back Door"
        device_class: lock #customised device class

Perfect, thanks!

Thank you! Works perfect!