Add HA blueprints for slot usage limiting and calendar integration#902
Open
Add HA blueprints for slot usage limiting and calendar integration#902
Conversation
Introduce three Home Assistant blueprints that externalize slot usage tracking and calendar-based code slot management: - Slot Usage Limiter (automation): Decrements an input_number helper on each PIN use and disables the slot at zero. Supports auto-reset on re-enable. - Calendar Condition (template): Creates a binary_sensor that activates when a calendar event is active, with optional condition template filtering. Assignable as an LCM slot condition entity. - Calendar PIN Setter (automation): Extracts PINs from calendar event attributes via user-provided templates and sets them on LCM slots. Optionally clears the PIN when the event ends. Also excludes blueprints/ from the check-yaml pre-commit hook since HA's !input YAML tag is not recognized by standard YAML loaders. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: ac889c35c3d6
Link to the three LCM blueprints (Slot Usage Limiter, Calendar Condition, Calendar PIN Setter) with My Home Assistant import badges and a pointer to the wiki for setup details. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 53d0b0eb198b
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Home Assistant blueprints to extend Lock Code Manager (LCM) with externalized automations for slot usage limiting and calendar-driven PIN/condition management, and updates pre-commit configuration to accommodate HA blueprint YAML tags.
Changes:
- Added an automation blueprint to decrement a remaining-uses counter on PIN use and disable the slot at 0.
- Added a template blueprint that exposes a calendar-driven binary_sensor intended for use as an LCM slot condition entity.
- Added an automation blueprint to set/clear slot PINs based on active calendar events.
- Excluded
blueprints/from thecheck-yamlpre-commit hook due to HA’s!inputtag.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
blueprints/template/lock_code_manager/calendar_condition.yaml |
Adds a template blueprint providing a calendar + template-gated binary_sensor for LCM slot conditions. |
blueprints/automation/lock_code_manager/slot_usage_limiter.yaml |
Adds an automation blueprint to track remaining uses and disable the slot when depleted. |
blueprints/automation/lock_code_manager/calendar_pin_setter.yaml |
Adds an automation blueprint to set/clear LCM slot PINs from calendar event attributes. |
.pre-commit-config.yaml |
Excludes HA blueprints from check-yaml to avoid failures on !input. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…_ids - slot_usage_limiter: document that code slot event support is required - calendar_condition: clarify lock_entity_ids only includes event-capable locks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 80f667d28c48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Add three Home Assistant blueprints that externalize slot usage tracking and calendar-based code slot management, keeping LCM lean while giving users more flexibility:
automation): Decrements a user-createdinput_numberhelper each time a code slot PIN is used. Automatically disables the slot when the counter reaches 0. Optionally resets the counter when the slot is re-enabled.template): Creates abinary_sensorthat turns ON when a calendar event is active and an optional condition template is truthy. Users assign this sensor as the LCM slot's condition entity.automation): Extracts PINs from calendar event attributes using a user-provided Jinja2 template and sets them on LCM code slots viatext.set_value. Optionally clears the PIN when the event ends.All blueprints derive LCM entity IDs automatically from a
config_entryselector + slot number usingintegration_entities()andconfig_entry_attr().Also excludes
blueprints/from thecheck-yamlpre-commit hook since HA's!inputYAML tag is not recognized by standard YAML loaders.Type of change
Additional information
blueprints/automation/lock_code_manager/andblueprints/template/lock_code_manager/condition_templatevariable is evaluated at template entity load time (and on HA template reload), not dynamically on each calendar event change. For the default{{ true }}, the sensor dynamically tracks calendar on/off state. This limitation is documented in the blueprint description.🤖 Generated with Claude Code