Lock Accessory for Door-buzzer
See original GitHub issueHi,
I’m trying to modify the standard Lock Accessory to control my apartment’s Door-buzzer. I hooked up the buzz-unlock-mechanics to an Arduino, and the Arduino is hooked up to a Relay which connects 2 wires for opening the door.
In this situation the door does not have an actual Secured and Unsecured reading. Thats because once the two wires have been connected, the door can be pushed open, and when the door falls shut again, you guessed it… it’s locked again.
So what I was thinking; once I’ve executed the unlock command, the door should unlock (UNSECURED) for 2 seconds and after those two seconds, it the lock should automatically reset it’s status back to the SECURED state again.
I’ve tried all sorts of code modifications but I could not get it to work.
Can you please point me in the right direction?
Thank you very much!!
Cheers!
Something I’ve tried as an example:
if (value == Characteristic.LockTargetState.UNSECURED) {
FRONT_DOOR_LOCK.unlock();
// now we want to set our lock's "actual state" to be unsecured so it shows as unlocked in iOS apps
lock
.getService(Service.LockMechanism)
.setCharacteristic(Characteristic.LockCurrentState, Characteristic.LockCurrentState.UNSECURED);
FRONT_DOOR_LOCK.lock();
// now we want to set our lock's "actual state" to be locked so it shows as open in iOS apps
lock
.getService(Service.LockMechanism)
.setCharacteristic(Characteristic.LockCurrentState, Characteristic.LockCurrentState.SECURED);
callback(); // Our fake Lock is synchronous - this value has been successfully set
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (2 by maintainers)
Top GitHub Comments
Hi, this is my final Solution:
Everything works like expected. I hope this helps you further.
In case this helps anyone, I have hacked my way around this by editing
LockMechanism.js
and removing the call to setinitial
to false. This has the effect of always setting theLockTargetState
to the real lock state, and IOS doesn’t show “Locking” for me anymore if I open my lock by hand.