I’m looking to create my very first Piston (after moving over from a working Flow in Stringify). What I’m looking to do is to monitor my “Front Door Lock” (A Kwikset 916 Z-wave) for when it becomes “Unlocked”.
Once its status changes to Unlocked I then want to start a timer that is different depending on the time of day. If the time of day is between 7am and 11pm then the timer should be 30 minutes. If the time of day is between 11pm and 7am then the timer should be 2 minutes.
Once the timer completes, the door should be locked.
LATER I hope/plan to add more to allow for factoring in location. If neither my wife or I are home and the door is unlocked (perhaps by a visiting family member) then always lock the door after say 1 minute. That doesn’t have to happen at this point however.
Any guidance appreciated, and thanks!
This is what I came up with so far and wondering if it’s the right way to go (or even close to correct)"
One big question I have with this is the “CHANGES TO” logic. Do I want “changes to unlocked” or do I want “is unlocked” or something else? I’m not sure what the implication of that would be. Perhaps the power goes out and the script comes up while the door is unlocked and, since the state doesn’t change, it doesn’t lock?