init(options?: LockSDKOption)

Requires:
@ray-js/lock-sdk≥1.0.0

Description

Initialize the SDK (single-device main path). With kind: 'fit', use the accessory bootstrap (passthrough report listeners, etc.); default is lock.

Parameters

ParameterTypeRequiredDescription
NoDevice and behavior options (devInfo/deviceId/kind, etc.; if omitted, deviceId can be read from launch parameters)

Return Value

Type: Promise<void>
None

Error Code

Error CodeError Message
1000Neither devInfo nor deviceId in the input, and no deviceId in the launch parameters

Valid Values

LockSDKOption.logLevel
ValueDescriptionSince
off--
error--
warn--
info--
debug--
trace--
LockSDKOption.kind
ValueDescriptionSince
lock--
fit--
screen--

Examples

import { init, openDoor } from '@ray-js/lock-sdk';
await init({ devInfo: { devId: 'deviceId', productId: 'productId' } });
await openDoor({ open: true });
// Accessory: await init({ deviceId: 'devFit', kind: 'fit' });