Native lock code functionality #1000
Replies: 3 comments 3 replies
-
I'm not sure there's a meaningful distinction between Option 1 & Option 2. If integrations are creating their own solutions, they are inherently using existing HA constructs. But I agree with your analysis of the cons here, and that's essentially why I didn't implement this for the Schlage integration: there's not really a clean way to model this in HA. Let's consider the features we would want a lock code to have:
Looking at the zwave certification list, I also see:
Some other interesting things to note:
There are probably other things worth considering, but that's what's top-of-mind for me. ;) |
Beta Was this translation helpful? Give feedback.
-
It seems this may also be considered at a higher level of abstraction. Rather than a entity for input of lock codes, I'd suggest a more generalized "table" input entity may be better (or, at least, for the underlying foundation to build this on). There are several input items that are tables in form - for example, Lock codes (rows with User ID, Status, Type, PINCode columns), Groups (rows with IDs, Groups Names, Members), Scenes (rows with ID, Name, Members), Schedules, etc. Perhaps the starting place for something like this is a concept like this flex-table-card lovelace https://github.com/custom-cards/flex-table-card?tab=readme-ov-file, and see example images: https://github.com/custom-cards/flex-table-card/blob/master/images/MultiExample.png, but extended into a reusable Entity that could appear on a device's page for lock codes, Groups, Scenes, or other data in 2D table form. Then build from this 2D Table Input Entity to the more purpose-specific integration implementation. |
Beta Was this translation helpful? Give feedback.
-
FYI, there is a feature request with related discussions from an end-user point-of-view in the Home Assistant's community forum here:
Can I suggest that you might also want to get zha/zigpy developers involved early for also looking at it from the Zigbee (ZHA) perspective? |
Beta Was this translation helpful? Give feedback.
-
CC @AlCalzone @marcelveldt for input from a Z-Wave/Matter perspective
Background
The
lock
platform natively allows users to control the lock state of a lock, but it is not possible, at least natively, to manage codes for the lock. While not all locks have this functionality, many integrations/protocols support this, includingzwave_js
,zigbee
,matter
, and proprietary WiFi/BLE locks.Today, integrations are forced to handle lock code management on their own. For
zwave_js
, there are zwave_js specific services to manage user codes, but there isn't a native UI that makes them easily manageable. As a result, there are integrations like https://github.com/FutureTense/keymaster which hack together a solution using a combination of the HA packages functionality, input helpers, and automations. In addition to generating a lot of artifacts which pollute a user's instance, the UI that gets created is not optimized for the use case and is quite complex given what it's trying to accomplish.Purpose
The purpose of the initial proposal is to come to a consensus that a new entity platform is needed to support codes. There are a lot of details to iron out about this platform, and we can discuss that as a follow up, but I first want to come to consensus that this is needed and that we can't use what we already have.
Considerations
person
entity to a code.Options
Option 1: Leave things as is and let integrations create their own solutions
We could choose to do nothing and to continue to let each integration figure this out. Integrations can provide a lot of this functionality through services, and when entity services support responses, most if not all of it will be available.
Pros:
Cons:
Considerations:
Option 2: Use existing HA constructs
Now that most of the input helpers have corresponding entity platforms, integrations could cobble together their own collection of entities that can be used to manage user codes.
text
entities could be used to view and set codes (and names), and a switch could be exposed to allow codes to be enabled/disabled.Pros:
text
entity already support regex validation and could be used to enforce requirements on the codeCons:
text
entity for code,text
entity for a name, and aswitch
entity for enabled state), that would result in 90 entities for my one lock. In addition to being a lot of entities, users would have to construct a UI for user code management themselves, and that UI would not be well optimized for the use case.Considerations:
Option 3: Establish a new entity type for codes
Pros:
text
entity) to provide the needed capabilities while giving integration owners a consistent pattern to follow.Cons:
Considerations:
lock
entity. While they would all be tied together through thedevice_registry
, I don't think we can assume that a single device is a single lock, although I don't have any good examples to support that theory.Recommendation
I recommend that we go with option 3 but spend some time researching what the requirements are that we need to support before creating an in depth proposal. Even if we were able to get certified using option 1 or 2, the user experience is not great (keymaster is a good way to "test" how option 1 or 2 might look like from a user perspective, and while some of the functionality would definitely be eliminated if integrations supported these things natively, my experience has shown that it is suboptimal)
Beta Was this translation helpful? Give feedback.
All reactions