Closed yungsters closed 8 years ago
@bryanbartow Since you do not have any locks, can you try testing this to make sure I have not broken anything for users without locks?
I've included a couple commits that implement caching. If GitHub were a better platform, I'd be able to propose these changes in a separate and dependent pull request. But unfortunately, a bloated pull request is all we have to work with. 👎
Seems to me to work fine without locks. I'm merging.
@yungsters I spoke to soon. Although for some reason it worked locally in debug mode, Homebridge is not happy about me not having locks. If I'm reading the code correctly, it looks like it's calling getLockAccessories()
on startup when the platform is instantiated. It's expecting the WrapAPI locks
call to return the locks object. When it makes that call and doesn't get it, it bombs. Can we make locks conditional? Maybe by adding a property in the config? useLocks: true/false
?
Can you share with me the error that you get? Ideally, the WrapAPI endpoint would simply return an empty array of locks.
@yungsters Listed the error in #16
Error while registering accessories: TypeError: Cannot read property 'map' of undefined
Adds support for controlling locks associated with an Alarm.com account to the plugin.
This also adds some primitive caching of the session (with a 60s timer) and responses (locks with a TTL of 5s) which should make most HomeKit user interfaces significantly more responsive.
Fixes #10 and partially addresses #13.