I’m trying to get the following piston working. In summary, I’m trying to replace the auto-lock functionality on our Schlage locks with something a little more customized. In particular, I want: 1) a simpler way to temporarily disable the auto-lock than needing to open the door, lock the lock, enter a user code, and then quickly re-lock and unlock again, and 2) locks not to auto-lock while the door is still open (I’m taking out the garbage, please don’t extend the deadbolt so I wham it into the door jamb when I come back), OR while it is closed without having been opened (I’m expecting the neighbor to come by so I’ve unlocked the lock from the inside).
The piston mostly works. I can (usually) temporarily disable auto-lock simply by unlocking via the knob twice within 5 seconds, and it won’t lock until the door has been opened and closed. The problem is in that “usually” – I find if I unlock/lock/unlock too quickly (say, within 1-2 seconds), the final ‘unlock’ is not registered as a state change. If I turn on full debugging, I see the first ‘unlock’ and the ‘lock’ are seen as changes, but the second ‘unlock’ is not viewed as a change, and the code to disable auto-lock is not run.
Is there just a basic limitation where events that come too quickly might result in state changes not being interpreted? Or do I need to change how I’m handling these events?
Note that I’m using the fancy new typed list feature in order to write this code once and have it work for multiple door/lock combinations – I’ve tried simplifying and I can’t definitively say yet that the behavior I’m seeing is specific to one or the other implementation. I only have two exterior doors, so I know I could just duplicate the code twice, but I thought I’d try to be fancy and write it once to work with both… bad idea? Am I missing a simpler way to only code it once? (The thing that makes it a little complicated is needing to act on different door/lock combinations rather than running the same code for all unlocked/locked/closed events.)
I’d just also like to add that I think webCoRE is absolutely amazing! I write software for my day job and I recognize what a huge undertaking this project is, and how polished it is. I’m really looking forward to learning how to use it to its full potential.
EDIT: I think one of the contacts is showing up as ‘Water Sensor 1’ because it’s a test device using uDTH so I can test the piston from the comfort of my sofa. I don’t think that’s related to my issue, because I can reproduce it with the physical door and lock.