Skip to main content

Overview

Seam provides a universal API to connect and control many brands of smart locks. This guide provides a rapid introduction to connecting and controlling your Omnitec lock using the Seam API. Omnitec locks must be connected through an Omnitec Rent&Pass Gateway for online access. To learn more about other smart lock brands supported by Seam, head over to our integration page.

1 — Install Seam SDK

Seam provides client libraries for many languages, such as JavaScript, Python, Ruby, PHP, and others, as well as a Postman collection and OpenAPI spec.
npm i seam
Once installed, sign up for Seam to get your API key, and export it as an environment variable:
export SEAM_API_KEY=seam_test2ZTo_0mEYQW2TvNDCxG5Atpj85Ffw
This guide uses a Sandbox Workspace. Only virtual devices can be connected. If you need to connect a real Omnitec lock, use a non-sandbox workspace and API key.

To control your Omnitec lock via the Seam API, you must first authorize your Seam workspace against your Omnitec account. To do so, Seam provides Connect Webviews: pre-built UX flows that walk you through authorizing your application to control your Omnitec lock.

Request a Connect Webview

import { Seam } from "seam";

const seam = new Seam();

const connectWebview = await seam.connectWebviews.create({
  accepted_providers: ["omnitec"],
});

console.log(connectWebview.login_successful); // false

// Send the webview URL to your user
console.log(connectWebview.url);

Authorize Your Workspace

Navigate to the URL returned by the Webview object. Since you are using a sandbox workspace, complete the login flow by entering the Omnitec sandbox test account credentials below: During the Connect Webview flow, you will also be prompted to select a time zone. You can choose any valid time zone. Confirm the Connect Webview was successful by querying its status:
const updatedWebview = await seam.connectWebviews.get(
  connectWebview.connect_webview_id
);

console.log(updatedWebview.login_successful); // true

3 — Retrieve Omnitec Lock Devices

After an Omnitec account is linked with Seam, you can retrieve devices for this Omnitec account. The Seam API exposes most of the device’s properties such as battery level or door lock status.
const allLocks = await seam.locks.list();

const someLock = allLocks[0];

console.log(someLock.properties.online); // true
console.log(someLock.properties.locked); // true

console.log(someLock);
/*
{
  device_id: '...',
  device_type: 'omnitec_lock',
  capabilities_supported: ['access_code', 'lock'],
  properties: {
    locked: true,
    online: true,
    manufacturer: 'omnitec',
    omnitec_metadata: {
      lock_id: '...',
      lock_name: 'Room 101',
      has_gateway: true
    },
    name: 'Room 101'
  },
  ...
}
*/

4 — Locking & Unlocking a Door

You can perform the basic actions of locking and unlocking an Omnitec lock.
// lock the door
await seam.locks.lockDoor(someLock.device_id);
const updatedLock = await seam.locks.get(someLock.device_id);
console.log(updatedLock.properties.locked); // true

// unlock the door
await seam.locks.unlockDoor(someLock.device_id);
const unlockedLock = await seam.locks.get(someLock.device_id);
console.log(unlockedLock.properties.locked); // false

5 — Setting Access Codes on an Omnitec Lock

Omnitec locks with a keypad support access code programming. The Seam API makes it easy to program both ongoing codes and timebound codes on an Omnitec lock. You can find out more about access codes in our guide on access codes.
// create an ongoing code
await seam.accessCodes.create({
  device_id: someLock.device_id,
  code: "123456",
  name: "Personal Access Code",
});

// create a timebound code
await seam.accessCodes.create({
  device_id: someLock.device_id,
  code: "888888",
  name: "Guest Access Code",
  starts_at: "2028-11-12T19:00:00+0000",
  ends_at: "2028-11-13T12:00:00+0000",
});

// list all access codes on the device
const accessCodes = await seam.accessCodes.list({
  device_id: someLock.device_id,
});

console.log(accessCodes);
/*
[
  {
    code: '123456',
    type: 'ongoing',
    status: 'setting',
    access_code_id: '...',
    name: 'Personal Access Code'
  },
  {
    code: '888888',
    type: 'timebound',
    status: 'setting',
    access_code_id: '...',
    name: 'Guest Access Code',
    starts_at: '2028-11-12T19:00:00.000Z',
    ends_at: '2028-11-13T12:00:00.000Z'
  }
]
*/

Next Steps

Now that you’ve completed this guide, you can try to connect a real Omnitec device. To do so, make sure to switch to a non-sandbox workspace and API key as real devices cannot be connected to sandbox workspaces. In addition, if you’d like to explore other aspects of Seam, here is a list of helpful resources: If you have any questions or want to report an issue, email us at support@seam.co.