diff --git a/custom_components/lock-manager/const.py b/custom_components/lock-manager/const.py index 4c8e837..8ca13e0 100644 --- a/custom_components/lock-manager/const.py +++ b/custom_components/lock-manager/const.py @@ -1,5 +1,5 @@ DOMAIN = "lock-manager" -VERSION = "0.0.28" +VERSION = "0.0.29" ISSUE_URL = "https://github.com/FutureTense/lock-manager" PLATFORM = "sensor" diff --git a/custom_components/lock-manager/lock_manager_common.yaml b/custom_components/lock-manager/lock_manager_common.yaml index 293f752..bfd4984 100644 --- a/custom_components/lock-manager/lock_manager_common.yaml +++ b/custom_components/lock-manager/lock_manager_common.yaml @@ -480,6 +480,15 @@ automation: {{ code_slot }} usercode: >- {{ range(1000, 9999) | random | int }} + - service: lock.clear_usercode + data_template: + node_id: >- + {{ state_attr('LOCKENTITYNAME','node_id') }} + code_slot: >- + {% set object_id = trigger.to_state.object_id %} + {% set index = object_id.rfind('_') + 1 %} + {% set code_slot = object_id[index:] %} + {{ code_slot }} - alias: CASE_LOCK_NAME Decrement Access Count trigger: