Skip to content

Commit

Permalink
added unique_id to template yaml entities (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omnipius authored May 22, 2024
1 parent 66e75de commit 8be2470
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions custom_components/keymaster/keymaster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ binary_sensor:
sensors:
active_LOCKNAME_TEMPLATENUM:
friendly_name: "Desired PIN State"
unique_id: "binary_sensor.active_LOCKNAME_TEMPLATENUM"
value_template: >-
{## This template checks whether the PIN should be considered active based on ##}
{## all of the different ways the PIN can be conditionally enabled/disabled ##}
Expand Down Expand Up @@ -263,6 +264,7 @@ binary_sensor:
pin_synched_LOCKNAME_TEMPLATENUM:
friendly_name: "PIN synchronized with lock"
unique_id: "binary_sensor.pin_synched_LOCKNAME_TEMPLATENUM"
value_template: >
{% set lockpin = states('sensor.LOCKNAME_code_slot_TEMPLATENUM').strip() %}
{% set localpin = states('input_text.LOCKNAME_pin_TEMPLATENUM').strip() %}
Expand All @@ -282,6 +284,7 @@ sensor:
sensors:
connected_LOCKNAME_TEMPLATENUM:
friendly_name: "PIN Status"
unique_id: "sensor.connected_LOCKNAME_TEMPLATENUM"
value_template: >-
{% set pin_active = is_state('binary_sensor.active_LOCKNAME_TEMPLATENUM', 'on') %}
{% set synched = is_state('binary_sensor.pin_synched_LOCKNAME_TEMPLATENUM', 'on') %}
Expand Down
3 changes: 3 additions & 0 deletions custom_components/keymaster/keymaster_child.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ binary_sensor:
sensors:
active_LOCKNAME_TEMPLATENUM:
friendly_name: "Desired PIN State"
unique_id: "binary_sensor.active_LOCKNAME_TEMPLATENUM"
value_template: >-
{## This template checks whether the PIN should be considered active based on ##}
{## all of the different ways the PIN can be conditionally enabled/disabled ##}
Expand Down Expand Up @@ -939,6 +940,7 @@ binary_sensor:
pin_synched_LOCKNAME_TEMPLATENUM:
friendly_name: "PIN synchronized with lock"
unique_id: "binary_sensor.pin_synched_LOCKNAME_TEMPLATENUM"
value_template: >
{% set lockpin = states('sensor.LOCKNAME_code_slot_TEMPLATENUM').strip() %}
{% set localpin = states('input_text.LOCKNAME_pin_TEMPLATENUM').strip() %}
Expand All @@ -958,6 +960,7 @@ sensor:
sensors:
connected_LOCKNAME_TEMPLATENUM:
friendly_name: "PIN Status"
unique_id: "sensor.connected_LOCKNAME_TEMPLATENUM"
value_template: >-
{% set pin_active = is_state('binary_sensor.active_LOCKNAME_TEMPLATENUM', 'on') %}
{% set synched = is_state('binary_sensor.pin_synched_LOCKNAME_TEMPLATENUM', 'on') %}
Expand Down
1 change: 1 addition & 0 deletions custom_components/keymaster/keymaster_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ timer:
lock:
- platform: template
name: boltchecked_LOCKNAME
unique_id: "lock.boltchecked_LOCKNAME"
value_template: "{{ is_state('LOCKENTITYNAME', 'locked') }}"
lock:
service: "{{ 'script.boltchecked_retry_LOCKNAME' if (is_state('DOORSENSORENTITYNAME', 'on')) else 'script.boltchecked_lock_LOCKNAME' }}"
Expand Down
1 change: 1 addition & 0 deletions custom_components/keymaster/keymaster_common_child.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ timer:
lock:
- platform: template
name: boltchecked_LOCKNAME
unique_id: "lock.boltchecked_LOCKNAME"
value_template: "{{ is_state('LOCKENTITYNAME', 'locked') }}"
lock:
service: "{{ 'script.boltchecked_retry_LOCKNAME' if (is_state('DOORSENSORENTITYNAME', 'on')) else 'script.boltchecked_lock_LOCKNAME' }}"
Expand Down

0 comments on commit 8be2470

Please sign in to comment.