Is there a way to reset the “code_format” of a lock at runtime?
Use Case: I have an integration option to setup the pin. The lock checks if the pin is in the config_entry. If the user is setting up the pin then we need a HA restart until the new code_format result gets active.
def code_format(self):
"""Return the required for digit code if the PIN is not set in config_entry."""
pin = self._data.client._config_entry.options.get(CONF_PIN, None)
if pin and pin.strip():
# Pin is set --> we don't ask for a pin
return None
# Pin is not set --> we ask for a pin
return "^\\d{%s}$" % 4