Couple of questions related to linking my lockitron to my HA system


#1

I just realized that the API is alive and well and want to get my MisterHouse HA system to chat with my lockitron.

First, is API v2 alive? Should I be scripting for that rather than V1?

Second, I was reading through the V1 docs/intro and the examples seem to be using outdated URLs… (no v1 in the URL)
https://api.lockitron.com/v1/getting_started/lock_data

curl -i
–data ‘access_token=fafafafafa’
–location https://api.lockitron.com/locks

Should be https://api.lockitron.com/v1/locks ?

Third, the examples suggest that I create an API key for each script/app I make, suggests I go to https://api.lockitron.com/oauth/applications which is the oauth page. Would I make my basic token here as well? (and how?)
(the sample token given me in the examples page only shows a virtual lock, not my real lock)
Last, is there a way to ask the lock what state it’s in? It’d be useful to issue alerts of the door remains unlocked too long, or lock it if unlocked when it’s bedtime.


#2

Oooh very good questions here.
I haven’t used MH in a long time. I’ve switched to OpenHAB myself.

Of course, I don’t work for Lockitron/Apigy.

That being said, to lead on the right path-

  1. re-API, yes, you’ll want to start coding for API v2 already. Make sure you sign up for the developer mailing list, and that should get you access.

  2. The API v2 page will help you get the access token, your “application” registered, and show you your actual locks.

  3. To my knowledge, right now there is nothing in the API documentation regarding state. It just shows “null”, but it is part of what’s returned when you list all locks, or query for a particular lock. This could be happening in the future. That’s more for @cameron or @pmg to answer.

There is a way to use webhooks to have your system notified when an action occurs. You can also poll for the last 10 activities (locked with app, unlocked by hand, etc).

You can also always issue an action (i.e… Bed time scene issues lock command to Lockitron), and if the lock is already in this state, it will just return a standard error. More is in the API v2 docs.