So, this should now be present in 2021.4.0 I haven’t tried the release build yet (or even the betas), but at least it worked before that!
Confirm. Works like a charm in the release build.
Now we need a ZHA lock manager add-on
This is so exciting. Thank you @vilord!
edit: Where do I find the documentation for how to use this manually, until it gets integrated into Keymaster?
I added documentation here:
Got it. Is there something like a view_lock_codes?
Services do not support return values, so no there is not.
Support is built in for getting lock codes with a key manager, but I have not yet worked with the KeyManager people to get ZHA added.
Yay! I’ve updated my HA to the version 2021.4 yesterday and tested - indeed works great.
Many thanks to @vilord !
Yep. That’s awesome. I was hoping to be able to view them. But for the meantime, I can just keep notes on slots.
I’ve finally been able to unplug my SmartThings hub! Thank you!
Is there any way to create automations yet when certain codes are used?
edit: n/m I was able to figure this out. Great excuse for me to finally try out the native HA automations.
Does lock manager support ZHA yet? I’ve been happy with setting them manually via the developer tools, but it also lacks any feedback or advanced features I like in lock manager
Hi, i am new into HA so please bear with me. Does it mean that with this new addition for ZHA, i can just get a zigbee lock and connected to ZHA and i can lock/unlock already?
You can (I think) now do everything with zigbee locks that you can with zwave, its just much more cumbersome.
Thanks so much for this - added both my Schlage zigbee locks today and was able to easily set codes via the dev panel.
Can someone give me a pointer on how to detect what code is used to unlock these? @flyize mentioned figuring this out when creating automation, I assume through state changes, care to share?
This isn’t pretty, but it works. Basically, you’ll have to go into Dev Tools > Events and listen for zha_events. When the door is unlocked, you’ll see an event like this (screenshot taken from Automations).
Once you have the device id, under args, you’ll see also see a slot parameter. Each unlock code is a slot. You’ll just have to tie together the unlock codes to a slot. Then it’s just a matter of finishing the automation.
Apologies for the screenshots, I should probably learn how to share native HA Automations (I normally just use NR).
I don’t know what’s this worth to you guys, but the wife really likes to be able to manage and see the lock codes for the front door and was the last thing i need to migrate from smartthings… Im still really new to hass so if there was a better way please let me know!
The lock code table is just markdown, so you will have to add / remove entries there as needed.
here is what i did.
- Grab GitHub - gadgetchnnel/lovelace-text-input-row: A custom Lovelace text input row for use in entities cards and install it
- Enable input_text on your configuration
- Enable scripts on your configuration (if not already)
Create a new dashboard with the following example
Lovelace template
views:
- title: Home
cards:
- type: vertical-stack
cards:
- type: entities
header:
image: >-
https://www.ryadel.com/wp-content/uploads/2017/11/IT-Security.jpg
type: picture
show_header_toggle: false
entities:
- type: custom:text-input-row
entity: input_text.codeslot
- type: custom:text-input-row
entity: input_text.usercode
- entity: script.add_code
icon: mdi:key-plus
- entity: script.clear_code
icon: mdi:key-minus
title: Code Details
- type: markdown
content: >
| ID | User |
Lockcode |
|:-----|:--------------------
|:----------------------------------------- |
|1 | User1 | <details>1111</details> |
|2 | User2 | <details>2222</details> |
|3 | User3 | <details>33333</details> |
title: Lock Codes
Create the add / clear scripts
Scripts
add_code:
alias: Add Lock Code
variables:
codeslot: '{{ states(''input_text.codeslot'') | int }}'
usercode: '{{ states(''input_text.usercode'') | int }}'
lock: YOUR.LOCK_DEVICE
mode: single
sequence:
- service: logbook.log
data:
name: Lock code added
message: 'slot: {{ codeslot }} was updated with a new code: {{ usercode }}'
- service: zha.set_lock_user_code
target:
device_id: YOUR LOCK ID
entity_id: YOUR LOCK ENTITY
data:
code_slot: '{{ codeslot }}'
user_code: '{{ usercode }}'
- service: notify.mobile_app_YOURPHONE
data:
message: USER REMOVE
title: FOOBAR
clear_code:
alias: Clear Lock Code
variables:
codeslot: '{{ states(''input_text.codeslot'') | int }}'
lock: YOUR.LOCK_DEVICE
mode: single
sequence:
- service: logbook.log
data:
name: Lock code added
message: 'slot: {{ codeslot }} was updated with a new code: {{ usercode }}'
- service: zha.clear_lock_user_code
target:
device_id: YOUR LOCK ID
entity_id: YOUR LOCK ENTITY
data:
code_slot: '{{ codeslot }}'
- service: notify.mobile_app_YOURPHONE
data:
message: USER REMOVE
title: FOOBAR
Add the following to your input_text
section
input_text:
codeslot:
name: Code Slot
initial: 0
usercode:
name: User Code
initial: 0
Here is what it looks like
No need for the extra steps in your Actions when you can just add code_slot: {code slot} under the operation: Unlock argument.
I just implemented it and it works pretty well.
In my case the next step is to notify my HA app. But you certainly don’t have to!
A couple of quick questions on your script.
lock: YOUR.LOCK_DEVICE
Is that an entity or device ID?
And I feel like a total newb for this one, but what the heck is a device_id and where do I find it?