Closed TreehouseFalcon closed 7 months ago
I'm not sure how to do this, but I was looking at the current implementation, and I refactored a few things and changed it to use async polling at 30 second intervals. The Home Assistant plugin also polls at 30s intervals. It seems more responsive now. I'll submit a PR and you can give it a try.
Also, I should point out, I am by no means any kind of expert here. I've hacked together another HB plugin, which was my first exposure to typescript and I've hacked on a few other plugins.
I'm going to research the idea of hooking straight into the subscription the Android app is using a bit more, but I can't guarantee anything quite yet. My parents have had issues with their lock battery dying rather quickly and I suspect it might be because Kwikset pings the lock itself to get an updated state. Seems excessive.
I monitored all the traffic to and from the lock and can confirm that polling the API does not trigger any additional traffic to or from the lock itself and should have no impact on battery life.
If your lock batteries are dying quickly, you might just check that there is no friction on the bolt and that it turns easily and freely. Sometime misalignment can cause the bolt to rub on the jamb or it can also bind internally.
Thanks for looking into that! Good to know the plugin isn't affecting battery life. I think in that case I'll close this issue for now.
Well, don't get me wrong, it would be really cool if you can figure out how to do it. But maybe not critical.
The plugin's current method of retrieving locked/unlocked status is through polling Kwikset's API on an interval. This should be investigated and changed to use the same method the Kwikset mobile app uses to send push notifications.