Entity "lock" with default code

I have an issue with a Shelly 1 that I configured via an helper as a lock.
I set the default code, but when I try to unlock, the code is not requested, neither when I unlock it directly nor when I unlock it with a button by calling the service “lock.unlock”.

image

I can’t figure out what’s wrong. Has anyone else experienced the same issue?

I’ve already tried doing it with custom cards, but I would like the entity itself to have the property of requesting the code, because otherwise, by directly calling the entity it’s still possible to turn on/off without needing to enter the pin.

I came across this discussion earlier, it seems that for the moment there is still no way to do it.

You can achieve this by using the confirmation parameter. Here’s a button card example:

type: buttons
  entities:
    - entity: binary_sensor.water_heater_state
      icon: mdi:water-plus-outline
      hold_action:
        action: perform-action
        action: switch.turn_on
        data:
          entity_id: switch.water_heater_switch
        confirmation:
          text: Do you really want this?

Thank you, I’ve already done this with the buttons, but it’s not the optimal solution because by directly opening the entity, it can be unlocked without requiring any code.
It would be nice to be able to configure a regular switch so that it requires a real security code, for example, to open external doors.