Add webhook-based event support for lock/unlock events#47
Open
jcoetsie wants to merge 1 commit into
Open
Conversation
Register a Home Assistant webhook endpoint and create a corresponding Bold API webhook during integration setup. Incoming events fire bold_lock_event HA events and update lock entity state and changed_by attribute with user info. Webhook is cleaned up on integration unload. The webhook payload schema is undocumented, so the handler extracts fields generically and logs the full payload at debug level. Closes lwestenberg#9 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
bold_lock_eventHA events (for automations), and update lock entity state andchanged_byattribute with user infochanged_byproperty toBoldLockEntityso users can see who last locked/unlockedContext
Closes #9 - This adds webhook-based event support so the integration can receive real-time lock/unlock notifications with user information, rather than relying solely on polling.
Companion PR: The library-side changes (webhook API methods) are in a separate PR on lwestenberg/bold_smart_lock.
Implementation details
homeassistant.components.webhookfor the HA-side webhook registrationget_url(hass, prefer_external=True, allow_cloud=True)to determine the webhook URLorganizationIdfrom the v2 devices API (owner.organizationId)manifest.json: addswebhookdependency, changesiot_classtocloud_pushhass.dataso the webhook handler can route events to the correct lock entityFiles changed
__init__.py- Webhook setup/teardown/handlerlock.py-changed_byproperty,handle_webhook_eventmethod, entity registration for webhook routingconst.py- New constants for webhook supportmanifest.json- Add webhook dependency, update iot_classTest plan
bold_lock_eventHA eventchanged_byattribute updates with user name from webhook payload🤖 Generated with Claude Code