This is a simple Zwave Lock and Door Manager for Home Assistant.
When I first migrated from Smartthings to Home Assistant, one of the very first things I needed to do was to figure out how to manage the lock codes on my Zwave (Kwikset) locks and have them auto lock after a period of time based on various door/motion sensors.
I discovered the KeyMaster integration and went with it. However, it was more complex than I needed and most of all it made my install messy with the hundreds of helpers it created that HA would report as restored entities every time I restarted HA. I wanted something simpler.
There had to be a simpler way, and this is what I developed using a handful of helpers and a few automations with very little customization needed. The key difference is that it doesn't support scheduling. There's one big automation that handles all 9 codes. Everything is simpler. The user experience is essentially the same as KeyMaster but far simpler to set up and maintain.
The automations support up to 9 distinct codes that can be selectively enabled/disabled and be set to provide a notification if the lock code is used.
I've also included example automations for auto-lock functionality and door open notifications.
- Download the package file: Download
simple_lock_manager_package.yamlfrom this repository - Create packages directory: If you don't already have one, create a
packagesdirectory in your Home Assistant configuration directory - Copy the package: Place
Simple_Lock_Manager_Package.yamlin yourpackagesdirectory - Enable packages in configuration.yaml: Add the following to your
configuration.yamlif not already present:homeassistant: packages: !include_dir_named packages
- Customize lock entities: Edit the
Simple_Lock_Manager_Package.yamlfile and replace the example lock entities with your actual lock entity IDs:lock.lock_deck_north_doorlock.lock_front_doorlock.garage_side_door_lock
- Customize notification service: In the lock notification automation, update the notification service and targets as needed
- Reload YAML: Go to Developer Tools/YAML and Reload all YAML to create the entities/automations
- Create dashboard: Create a new dashboard using the Dashboard configuration from
lockcodes_lovelace.yaml
The repository also includes example automations that you can customize for your setup:
- Auto-lock:
auto_lock_example.yaml- Automatically locks doors based on door sensors and motion detection - Door open notifications:
doors_open_notify_automation.yaml- Alerts when doors are left open too long
- Lock Entities: Update all lock entity references to match your actual lock entities
- Notification Services: Configure notification services in the lock notify automation
- Sensor Entities: For optional automations, update sensor entity references to match your setup
The package creates the following entities for each of the 9 lock code slots:
input_text.lock_code_slot_X_pin- The PIN code (5-10 digits)input_text.lock_code_slot_X_name- Name/description for the codeinput_boolean.lock_code_slot_X_state- Enable/disable the codeinput_boolean.lock_code_slot_X_notify- Enable/disable notifications for this code
Create a new dashboard and use the raw configuration editor to add the cards from lockcodes_lovelace.yaml. You'll need to update the user visibility settings to match your Home Assistant users.
- The code supports up to 9 distinct lock codes
- The system uses Z-Wave JS for lock code management
- PIN codes must be 5-10 digits and numeric only
- The notification system can be customized to use any Home Assistant notification service
- For production use, customize all entity references, sensor names, and notification services (i.e. any hardcoded entity and notification service names to match your setup).
- Ensure your locks are properly integrated with Z-Wave JS
- Verify entity IDs match your actual lock entities
- Check that the packages directory is properly configured in configuration.yaml
- Use Developer Tools to test automation triggers and actions
Feel free to submit issues, feature requests, or pull requests.