-
Notifications
You must be signed in to change notification settings - Fork 9
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
Time sync with Nuki opener #88
Comments
Thanks for the feedback. |
@dotdoom The action has one optional parameter "time", that is a datetime type. You can use the built-in scripting feature to have different time formats. If you don't specify a time the local machine time is used (converted to UTC). I hope this solves your issue. If not let me know and i will try to improve the solution. |
Thank you @ronengr ! Now that esphome/issues#6701 fix is under review, I'm moving the rest of my Nuki locks from esphome custom component and into a btproxy soon, so this is indeed very timely. I'll let you know how it goes with testing, and update this issue. |
@ronengr I have given it a try; there's something I might not be getting correctly. There doesn't seem to be an option to choose which lock I want to update. Among them, it seems a random lock will be updated; I'm guessing it takes the last registered lock, because the code keeps overriding the handler to the next device: hass_nuki_bt/custom_components/hass_nuki_bt/__init__.py Lines 114 to 126 in e022e25
Note how async_register doesn't take any device ID with it, i.e. action handler seems to be global, and Final note: it would be even nicer if the service could return whether update was successful. There are plenty of reasons why an update may fail, e.g. bluetooth unreachable, incorrect PIN, lock refused to take specified time etc. |
oops. I'm new to services in HA, so I just used the easiest I could find. I will look for a better solution. |
Checklist
Is your feature request related to a problem? Please describe.
The clock in Nuki opener may drift away over time, or shift during DST transition, resulting in scheduled Night mode being off the clock. Nuki API has a "update time" function (which is locked behind a security PIN).
Describe the solution you'd like
We could have a periodic time sync, or based on the drift of Nuki's clock.
Here's an example, the code is for esphome platform:
https://github.com/dotdoom/esphome/blob/bc12358d51eb7ab0f3140d1d86a9feb1e15ab212/components/nuki_lock/nuki_lock.cpp#L234-L275
Describe alternatives you've considered
Simulating Night mode behavior in HA would be possible, but is less reliable than having a lock manage its state automatically.
Additional context
The "set time" function has a code of 0x0021. Details can be found in Nuki's excellent API documentation e.g. https://github.com/I-Connect/NukiBleEsp32/blob/198482dabd3a6e8204af2b918482a888cf69e97a/documentation/20200316NukiSmartLockAPI2_1.pdf
The text was updated successfully, but these errors were encountered: