Smart deadbolts, the Australian edition

And your experience with T-Lock has been good with ZHA? I find with Zigbee2Mqtt there is a solid 1-3 second delay when unlocking/locking from the UI? Do you experience the same?

Yes it has been perfectly fine with one exception.

As we renovated a bit last year we had several power outages due to electrical work. The lock did not automatically reconnect to the network after power came back. I have to pair it again each time (though the entity names are maintained so it’s pretty painless. The issue is that it breaks all my related automations til I pair it.

I’d say 1-3 seconds is typical for me too. But I rarely unlock it from the UI.

1 Like

I looked into it and my coordinator is only compatible with ZHA according to the guy who built it.

Hi all, regarding the T-Lock, I’m assuming (maybe incorrectly) that you can only program the user pin codes from the lock itself, not from HA?

No, after you have done the master you can do the rest from HA using scripts.

I use automations to activate certain codes for tradies and our cleaner based on calendar events.

This is my Lock manager dashboard consisting entirely of stolen ideas from the forums.

2 Likes

Very cool, thanks for the info. Time to order one I think.

Any chance of getting a copy of the code you have put together for your lock manager dashboard? This would be really useful. Thanks.

1 Like

I’d also love to see the code when you have a chance.

This is the lovelace card:

header:
  image: https://www.ryadel.com/wp-content/uploads/2017/11/IT-Security.jpg
  type: picture
show_header_toggle: false
entities:
  - type: custom:hui-element
    card_type: vertical-stack
    cards:
      - type: custom:hui-element
        card_type: vertical-stack
        cards:
          - type: custom:hui-element
            card_type: horizontal-stack
            cards:
              - type: entities
                entities:
                  - type: custom:text-input-row
                    entity: input_text.slot_id
                  - type: custom:text-input-row
                    entity: input_text.user_pin
              - type: custom:hui-element
                card_type: vertical-stack
                cards:
                  - type: custom:hui-element
                    card_type: horizontal-stack
                    cards:
                      - type: entity-button
                        tap_action:
                          action: call-service
                          service: script.clear_fields
                        hold_action:
                          action: more-info
                        show_icon: false
                        name: Clear fields
                        entity: script.clear_fields
                        icon_height: 25px
                  - type: custom:hui-element
                    card_type: horizontal-stack
                    cards:
                      - type: custom:button-card
                        entity: switch.tradie_mode
                        show_icon: true
                        show_state: false
                        state:
                          - value: 'on'
                            name: 'On'
                          - value: 'off'
                            name: 'Off'
                        styles:
                          card:
                            - height: 80px
                            - width: null
                      - type: custom:button-card
                        entity: switch.holiday_mode
                        show_icon: true
                        show_state: false
                        state:
                          - value: 'on'
                            name: Holiday
                          - value: 'off'
                            name: Home
                        styles:
                          card:
                            - height: 80px
                            - width: null
          - type: entities
            entities:
              - entity: input_select.lock
                card_mod:
                  style:
                    hui-generic-entity-row $: |
                      state-badge {
                        display: none;
                      }
              - entity: script.add_code
              - entity: script.remove_code
              - entity: script.add_single_use_code
              - entity: script.enable_code
              - entity: script.disable_code
          - type: entities
            entities:
              - lock.front_door_lock
              - lock.back_door_lock
type: entities
state_color: false

Here is my ‘package’ called locks.yaml

input_text:
  slot_id:
    name: ID
    initial: ""
  user_pin:
    name: Pin
    initial: ""

input_select:
  lock:
    options:
      - Front Door
      - Back Door
    initial: Front Door

script:
  add_code:
    alias: Add Lock Code
    icon: mdi:key-plus
    variables:
      slot_id: "{{ states('input_text.slot_id') | int }}"
      user_pin: "{{ states('input_text.user_pin') | int }}"
      lock: >
        {% if is_state("input_select.lock", "Front Door") %} lock.front_door_lock
        {% elif is_state("input_select.lock", "Back Door") %} lock.back_door_lock
        {% endif %}
    mode: single
    sequence:
      - service: zha.set_lock_user_code
        target:
          entity_id: "{{ lock }}"
        data:
          code_slot: "{{ slot_id }}"
          user_code: "{{ user_pin }}"
      - service: logbook.log
        data:
          name: Lock code added
          message: "slot: {{ slot_id }} on {{ lock }} was updated."
      - service: notify.mobile_app_pixel_4a
        data:
          message: "slot: {{ slot_id }} was updated with a new code: {{ user_pin }}"
          title: New pin - {{ states('input_select.lock') }}
          data:
            ttl: 0
            priority: high
            channel: "Locks"

  remove_code:
    alias: Remove Lock Code
    icon: mdi:key-minus
    variables:
      slot_id: "{{ states('input_text.slot_id') | int }}"
      lock: >
        {% if is_state("input_select.lock", "Front Door") %} lock.front_door_lock
        {% elif is_state("input_select.lock", "Back Door") %} lock.back_door_lock
        {% endif %}
    mode: single
    sequence:
      - service: zha.clear_lock_user_code
        target:
          entity_id: "{{ lock }}"
        data:
          code_slot: "{{ slot_id }}"
      - service: logbook.log
        data:
          name: Lock code removed
          message: "slot: {{ slot_id }} was removed from {{ states('input_select.lock') }} Lock"
      - service: notify.mobile_app_pixel_4a
        data:
          message: "slot: {{ slot_id }} was deleted on {{ states('input_select.lock') }} Lock"
          title: Pin removed - {{ states('input_select.lock') }}
          data:
            ttl: 0
            priority: high
            channel: "Locks"

  disable_code:
    alias: Disable Lock Code
    icon: mdi:account-cancel
    variables:
      slot_id: "{{ states('input_text.slot_id') | int }}"
      lock: >
        {% if is_state("input_select.lock", "Front Door") %} lock.front_door_lock
        {% elif is_state("input_select.lock", "Back Door") %} lock.back_door_lock
        {% endif %}
    mode: single
    sequence:
      - service: zha.disable_lock_user_code
        target:
          entity_id: "{{ lock }}"
        data:
          code_slot: "{{ slot_id }}"
      - service: logbook.log
        data:
          name: Lock code disabled
          message: "slot: {{ slot_id }} was disabled on {{ states('input_select.lock') }}"
      - service: notify.mobile_app_pixel_4a
        data:
          message: "slot: {{ slot_id }} was disabled on {{ states('input_select.lock') }}"
          title: Pin disabled - {{ states('input_select.lock') }}
          data:
            ttl: 0
            priority: high
            channel: "Locks"

  enable_code:
    alias: Enable Lock Code
    icon: mdi:account-check
    variables:
      slot_id: "{{ states('input_text.slot_id') | int }}"
      lock: >
        {% if is_state("input_select.lock", "Front Door") %} lock.front_door_lock
        {% elif is_state("input_select.lock", "Back Door") %} lock.back_door_lock
        {% endif %}
    mode: single
    sequence:
      - service: zha.enable_lock_user_code
        target:
          entity_id: "{{ lock }}"
        data:
          code_slot: "{{ slot_id }}"
      - service: logbook.log
        data:
          name: Lock code enabled
          message: "slot: {{ slot_id }} was enabled on {{ states('input_select.lock') }}"
      - service: notify.mobile_app_pixel_4a
        data:
          message: >
            slot: {{ slot_id }} was enabled on {{ states('input_select.lock') }}
          title: Pin enabled
          data:
            ttl: 0
            priority: high
            channel: "Locks"

  clear_fields:
    alias: Clear Input Text Fields
    mode: single
    sequence:
      - service: input_text.set_value
        target:
          entity_id:
            - input_text.slot_id
            - input_text.user_pin
        data:
          value: ""

  add_single_use_code:
    alias: Add Single Use Code
    mode: single
    icon: mdi:numeric-1-circle-outline
    variables:
      slot_id: "111"
      user_pin: "{{ states('input_text.user_pin') | int }}"
      lock: >
        {% if is_state("input_select.lock", "Front Door") %} lock.front_door_lock
        {% elif is_state("input_select.lock", "Back Door") %} lock.back_door_lock
        {% endif %}
    sequence:
      - service: zha.set_lock_user_code
        target:
          entity_id: "{{ lock }}"
        data:
          code_slot: "{{ slot_id }}"
          user_code: "{{ user_pin }}"
      - service: logbook.log
        data:
          name: Single use Code Created
          message: on {{ states('input_select.lock') }}
      - service: notify.mobile_app_pixel_4a
        data:
          message: "{{ user_pin }}*"
          title: "Single use Code Created - {{ states('input_select.lock') }}"
          data:
            ttl: 0
            priority: high
            channel: "Locks"
            color: yellow
      - service: notify.mobile_app_kates_s21
        data:
          message: "{{ user_pin }}*"
          title: "Single use Code Created - {{ states('input_select.lock') }}"
          data:
            ttl: 0
            priority: high
            color: yellow

#### Lock Summary #####################################################################
#### Source: https://community.home-assistant.io/t/wildcard-entities-card/72969/3
#######################################################################################
template:
  - sensor:
      - name: Lock Summary
        state: >
          {%-for state in states.lock
              if state.state== "unlocked" -%}
                {%-if loop.last-%}
                  {%-if loop.index > 0-%}
                    {%-for state in states.lock if state.state == "unlocked" -%}
                      {{state.name | replace('Lock', '')}}{%-if not loop.last -%}{%-if(loop.index+1==loop.length)%} & {%else%}, {%endif-%}{%-else%} unlocked{%endif-%}
                    {%-endfor-%}
                  {%-endif-%}
                {%-endif-%}
              {%-else-%}
                All locked
            {%-endfor-%}
        icon: >
          {%-for state in states.lock
            if state.state == "unlocked" -%}
              {%-if loop.last-%}
                {%-if loop.index > 0-%}
                    mdi:lock-alert-outline
                {%-endif-%}
              {%-endif-%}
            {%-else-%}
              mdi:lock-check-outline
          {%-endfor-%}
        attributes:
          count: |-
            {%-for state in states.lock
              if(state.state=="unlocked")-%}
                {%-if loop.last-%}
                  {%-if loop.index > 0-%}
                    {{loop.length}}
                  {%-endif-%}
                {%-endif-%}
              {%-else-%}
                0
            {%-endfor-%}
          history_1: "{{ state_attr('sensor.lock_summary', 'history_1') }}"
          history_2: "{{ state_attr('sensor.lock_summary', 'history_2') }}"
          history_3: "{{ state_attr('sensor.lock_summary', 'history_3') }}"
          history_4: "{{ state_attr('sensor.lock_summary', 'history_4') }}"
          history_5: "{{ state_attr('sensor.lock_summary', 'history_5') }}"
          history_6: "{{ state_attr('sensor.lock_summary', 'history_6') }}"
          history_7: "{{ state_attr('sensor.lock_summary', 'history_7') }}"
          history_8: "{{ state_attr('sensor.lock_summary', 'history_8') }}"
          history_9: "{{ state_attr('sensor.lock_summary', 'history_9') }}"
          history_10: "{{ state_attr('sensor.lock_summary', 'history_10') }}"

And the automation to set the unlock history is posted 2 weeks earlier Here

I use the tradie mode and holiday mode to enable and disable various automations. e.g tradie mode stops my doors auto locking and disables my phone getting notifications for motion alerts.

Edit: made some improvements

Edit Jun 2022. more improvements

5 Likes

Thanks for sharing that. I’m not sure Z2M supports sending codes, might have to do some more digging.

Ahh right. ZHA has built in services which I am calling. Hope you can find a solution

Did you get anywhere with finding a HA-compatible smart lock with fingerprint access? I’m in NZ and looking for one of these too.

Hi all, have just installed the lock. Quick question, when the door looks, it seems to go through the process twice, and the keypad also flashes up twice. Is that normal?

Is the bolt having difficulty extending fully?

1 Like

@SgtBatten yep that was it… after I took a second look I noticed it… drilled like a madman and problem fixed…

is the Zigbee paring fairly straightforward?

Yes it was as easy as entering the network pairing mode (option 7 I think) on the lock and pressing 1 to join while searching for new devices in home assistant (I use zha)

Hi does anyone know if Samsung SHP-DH537 works with HA?

You show no information, not even whether it is zigbee, zwave wifi.

Hi, I’ve been checking what lock you were talking about but failed to find it. Could you please share what it was? Thank you.

This is the one I have on my garage/front door. Works with Zigbee2mqtt

4 Likes