Seam API Docs
Search…
Connecting Schlage Locks

Schlage Locks

Schlage Encode Wifi Locks can be connected to your local wifi network with a bluetooth-enabled phone. These locks can then be remotely locked or unlocked with the Seam API, as well as progra access code to allow keyless entry.

Overview

To pair a Schlage lock with our API, we'll need to sign into a Schlage account. We can do this by creating a Seam Webview.
Make sure to install the relevant Seam package for your language...
Python
Javascript
1
from seamapi import Seam
2
3
seam = Seam()
4
5
webview = seam.connect_webviews.create(accepted_providers=["schlage"])
6
7
assert webview.login_successful is False
8
9
# Send the webview URL to your user
10
print(webview.url)
Copied!
1
import Seam from "seamapi"
2
3
const seam = Seam()
4
5
const webview = await seam.connect_webviews.create({
6
accepted_providers: ["schlage"]
7
})
8
9
console.log(webview)
10
/*
11
{
12
"connect_webview_id": "811b80e7-7c87-4ce1-a938-2f6936851aa9",
13
"url": "https://connect.getseam.com/v1/connect_webviews/view?connect_webview_id=811b80e7-7c87-4ce1-a938-2f6936851aa9&auth_token=GXtMoAaperbuNhSCByyQMroT9HMRquXK6",
14
"device_selection_mode": "none",
15
"accepted_providers": [
16
"schlage"
17
],
18
"created_at": "2022-01-03T21:11:27.002Z",
19
"login_successful": false,
20
"status": "pending"
21
}
22
*/
Copied!
We should now send the Connect Webview URL to the user, when the user signs in, we'll see a "completed" status on the webview or login_successful set to true.
Python
Javascript
1
updated_webview = seam.connect_webviews.get(webview.connect_webview_id)
2
3
assert updated_webview.login_successful
Copied!
1
const updated_webview = await seam.connect_webviews.get(webview.connect_webview_id)
2
3
console.log(updated_webview.login_successful)
4
// true
Copied!
We can now find all the devices that are associated with the third-party account that was signed into. From the returned payload, we can see if a lock's door is open, and see if the lock is locked or unlocked.
Python
Javascript
1
from pprint import pprint
2
3
all_locks = seam.locks.list()
4
5
some_lock = all_locks[0]
6
7
assert some_lock.properties["online"] is True
8
assert some_lock.properties["locked"] is True
9
10
pprint(some_lock)
11
# Device(device_id='a8669e4c-76e3-4db6-a827-11a65eb360ba',
12
# device_type='schlage_lock',
13
# location=None,
14
# properties={'schlage_metadata': {...}},
15
# 'locked': True,
16
# 'online': True})
Copied!
1
const all_locks = await seam.locks.list()
2
3
const some_lock = all_locks[0]
4
5
console.log(some_lock)
6
/*
7
{
8
device_id: 'a8669e4c-76e3-4db6-a827-11a65eb360ba',
9
device_type: 'schlage_lock',
10
location: null,
11
properties: { schlage_metadata: {...} },
12
locked: true,
13
online: true
14
}
15
*/
Copied!

Locking a Door

post
/locks/lock_door
Python
Javascript
1
seam.locks.lock_door(some_lock)
2
3
updated_lock = seam.locks.get(some_lock.device_id)
4
5
assert updated_lock.properties["locked"] is True
Copied!
1
await seam.locks.lock_door({ lock: some_lock })
2
3
const updated_lock = await seam.locks.get(some_lock)
4
5
console.log(updated_lock.properties.locked)
6
// true
Copied!

Unlocking a Door

post
https://connect.getseam.com
/locks/unlock_door
Unlock a door
Python
Javascript
1
seam.locks.unlock_door(some_lock)
2
3
updated_lock = seam.locks.get(some_lock.device_id)
4
5
assert updated_lock.properties["locked"] is False
Copied!
1
await seam.locks.unlock_door({ lock: some_lock })
2
3
const updated_lock = await seam.locks.get(some_lock.device_id)
4
5
console.log(updated_lock.properties.locked)
6
// false
Copied!

Create an Access Code

post
https://connect.getseam.com
/access_codes/create
Create an Access Code
Python
Javascript
1
access_code = seam.access_codes.create(
2
lock=some_lock,
3
code="876543",
4
)
5
6
pprint(access_code)
7
# AccessCode(
8
# access_code_id='a8669e4c-76e3-4db6-a827-11a65eb360ba',
9
# type='ongoing',
10
# code='876543',
11
# starts_at='2022-01-13T21:17:56.138Z'
12
# ends_at=None,
13
# location=None,
14
# )
Copied!
1
const access_code = await seam.access_codes.create({
2
lock: some_lock,
3
code: "876543",
4
})
5
6
console.log(access_code)
7
/*
8
{
9
"access_code_id": "a8669e4c-76e3-4db6-a827-11a65eb360ba",
10
"code": "876543",
11
"type": "ongoing",
12
"starts_at": "2022-01-13T21:17:56.138Z",
13
"ends_at": null
14
}
15
*/
Copied!

Delete an Access Code

delete
https://connect.getseam.com
/access_codes/remove
Remove an Access Code
Python
Javascript
1
seam.access_codes.remove(some_code)
Copied!
1
await seam.access_codes.remove({
2
code: some_code
3
})
Copied!

Setting an Access Code

Python
1
seam.access_codes.create(
2
device=some_lock, code="123456", name="Personal Access Code"
3
)
Copied!

Listing Access Codes

Python
1
# you can use a device or a device_id as the "device" parameter
2
seam.access_codes.list(device=some_lock)
3
# [
4
# AccessCode(
5
# access_code_id='af5272b1-2a49-4eb5-9388-2447fc7b5bd1',
6
# type='ongoing',
7
# code='123459'
8
# )
9
# ]
Copied!
Last modified 7d ago