Lock user codes active/inactive based on presence

Coming from SmartThings I was using an app from Rboy that would enable/disable user codes based on their presence. Awhile back I saw a thread where one of the Hubitat staff discussed this and offered an example of how to do this. I can no longer find that thread.

Can anyone offer any assistance or ideas on how to accomplish this?


I normally don’t trust presence to be accurate enough to be useful/reliable but if I were to consider developing a rule for this the easiest way would be to use presence to enable/disable the device, and thus the codes. Believe the rule would need to invoke an http call to:


and of course false to re-enable

1 Like

Thanks, I need to lock to be available to those present but not those not present.

Okay that throws out my suggestion...

My cats have the pet door unlock by their microchip being near the door. Perhaps something similar could be done for people.

That’s actually the right scenario, in that they need a secondary local authentication.

Going along that thinking, if you actually managed their codes separate from the lock you could detect presence and then allow a hidden master code to open the lock when they authenticate to the app using another code.

1 Like

Interesting concept.

I schedule lock codes by day/time using an example I saw here from bravenel. You could use your trigger and do similar actions to this. At first I thought it was awkward, but I've been using it without issue for quite a while. See the comment under the pic below.

Note: the first parameter to setCode is a number, and the last two are strings.

1 Like

I actually found his post with the instructions for the 3 parameters and successfully created the rules yesterday based on user presence.

Thank you for taking the time to post this though.