Siri Shortcut for setting lock PIN

Hi all,

I’m using the Apple Shortcuts app to speed up creation of PINs on my Yale lock. I’m not a developer, but I know enough to be dangerous.

I use this command to program the lock:

http://:3480/data_request?id=action&DeviceNum=110&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&json=&UserCodeName=test2&newPin=8888

I then take the returned UserCode and try to create a restriction that will expire the code on a certain date (for Airbnb guests).

http://:3480/data_request?id=action&DeviceNum=110&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetPinValidityDate&UserCode=5&StopDate=2019-06-11-18-29

The problem is I don’t know how to query the lock to know if it’s ready so the second command will Error with “lock not ready.”

The question is: what’s the command to see if the lock is ready OR should I just keep trying every few seconds until Error is not returned?

I tried using http://:3480/data_request?id=jobstatus&job= to get the status of the job that was returned, but it always returns -1

Any ideas?

1 Like

I have a plugin I’ve written to manage lock codes and so far, that’s pretty much the approach I’ve had to take even in Lua directly: keep trying until you stop getting errors. Setting PINs and schedules takes time, and during that time, you can’t communicate with the lock, and have no idea when it’s done. It also will frequently deadlock and cause a Luup reload, so even if you could query status, you’d have to tangle with that. There be monsters.

Thanks for the reply! Well, at least there’s not something I’m missing here. Do you know why all my job status requests are coming back as -1?

Well, doesn’t seem like anyone cares since there’s no other postings about Siri Shortcuts. But in case anyone is interested, I was able to do the following:

  1. Get the next Airbnb guest from my calendar (Name, Checkout Date, last 4 digits of phone number, email)
  2. Send Name and and Last4 as variables to Vera which programs the lock
  3. Wait 15 and try: send checkout date as PIN restriction so the PIN would delete automatically.

By searching the PinCodes variable I can see if the PIN already exists and stop the shortcut and by checking for an error condition I can retry if the lock is busy.

Lastly, the shortcut calls another shortcut and emails the guest with checkin info.

1 Like