-
-
Notifications
You must be signed in to change notification settings - Fork 36.4k
Add a sensor for Yale Lock operation #151436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
Hey there @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
cefd8ef to
08f3ab8
Compare
|
I'll be working through getting the necessary support in the |
|
Here's a diff for a proof of concept that implements the following:
If this approach were approved, the code would probably need to be refactored to add a coordinator to the integration. Putting this logic in a coordinator would better replicate the style across HA integrations with respect to separation of concerns. |
|
In Home Assistant's architecture, entity states are always meant to represent the current, real-time state (or as close as possible) of devices. Since lock operations/activities are inherently historical data (they represent past events like "locked 5 minutes ago" or "unlocked by user X at 3pm"), and we don't have access to them in real-time, a sensor entity storing this information would not be accepted as it violates core architectural principles. While events aren't a perfect fit either (they're really designed for real-time occurrences), they're the best mechanism we currently have in Home Assistant for handling this type of historical activity data. The key difference is that events don't pollute the state machine with non-current data. |
|
Also there is definitely some demand for inserting historical data, and its come up many times before. An architecture discussion on home-assistant/architecture#580 this topic that has yet to conclude. Inserting historical states into the database would need an approved arch discussion and a proper API on the recorder history module like stats currently has. |
Yes, I had a feeling that I was hacking around in ways that would be rejected. 😛 I'll subscribe to that discussion and see how it resolves. I know it's a Pandora's box sort of situation for HA to handle historic data. For my use case, I'll be 100% content with consuming events. So I'll give it another go with events. Would a proper event entity or just something fired on the bus be preferred? The Event Entity seems more suited to things as they're happening as well, but has the advantage of being easier to enable/disable as well as easier to discover. |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
|
I will be coming back to this soon. @bdraco if you have any opinions on the change in direction, it would help. My previous comment had the main question that needs input:
|
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
08f3ab8 to
db5f666
Compare
|
@bdraco I've taken another stab at this and updated the underlying In this iteration, I've stopped using a sensor and have switched over to using an Let me know what you think and how to move forward from here. Sorry it took so long for me to get back to this. Oh, this is also technically incomplete still until the PR gets merged in |
Breaking change
Proposed change
There needs to be a way to access the activity from Yale Access BLE. I followed the way that the Yale integration is handling things and added a sensor.
Some requirements I think are worth considering:
yalexs_blepackage reads the activity, it is removed from the lock and the Yale app will not be able to see it either.Ideas on how things could be improved:
recorder's history for the sensor to show a more accurate timeline of activity. I may be looking in the wrong places, but it looks like the only integrations they seem to do this are energy related components, so this may end up being an idea that's a little out there.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: