createSDK(options?: SDKOptions)

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

Description

Create an independent SDK instance for the specified device (recommended for multi‑device scenarios).

Parameters

ParameterTypeRequiredDescription
NoOptions; kind: 'fit' creates an accessory instance, default is lock.

Return Value

Type: Promise<LockSDKInstance>
SDK instance (lock or accessory, depending on kind)

Referenced Types

typeLockSDKInstanceSDK instance type (shared by locks and accessories). `destroy`/`updateConfig` are instance-scoped closures; others are exposed at the package top level.
PropertyTypeDescription
destroy() => voidDestroy the current instance: unregister the device Runtime, clear in-memory state and listeners (accessory instances also release passthrough report listeners).
Update the runtime configuration for the current instance (applies only to this instance’s device).
Get cloud storage service status (purchased or not / remaining days, etc.)
Get VAS benefits popup content (vouchers to claim / auto-claimed)
Claim VAS benefits
Get VAS notification settings (scenario switches and push methods)
Update VAS notification settings (incrementally update a single switch by key path)
Get VoIP service authorization / push target info
Set the VoIP push target (select the family member to receive incoming calls).
Query gesture password status (enabled or not + cloud password string).
Get the current user
Synchronously read the current user from cache (no request is made).
Read the device's overall status (online/sleep, etc.).
Subscribe to aggregated device status changes (online/sleep, etc.).
Unsubscribe from device status changes (must use the same `callback` reference as when subscribing).
Read the current value of a device DP
Check whether the device supports a DP
Send DP to the device
Listen for offline DP updates
Unregister the offline DP update listener
Send offline DP
Get offline DP list
Get the offline DP cache entry for the specified code
Determine whether the specified offline DP is still syncing (push not completed).
Query the user list with pagination/keywords.
Get details of a single user.
Update user validity, permanent flag, and offline unlock restrictions.
Open the home user details page
Add a regular user
Delete a regular user
Add a shared user (Bluetooth door lock).
Update a shared user (Bluetooth door lock).
Remove a shared user (Bluetooth door lock).
Get the shared user list
Trigger the cloud/device sync process to delete user-related data.
Send a command to the device to synchronize unlock methods
Get unlock method details
Check whether SMS notifications are supported
Add a password-type unlock method.
Start adding an unlock method
Cancel the ongoing add unlock method process.
Update unlock method
Delete an unlocking method.
Check whether there are unbound unlocking methods
Get the list of unbound unlocking methods
Bind unbound unlocking methods to a user
Unbind the user's unlocking method
No unlocking method is associated with the user in the binding record
Send SMS verification code
Register a step listener for unlocking methods
Unregister the step listener for unlocking methods
Get the guide image or video for the specified unlock method type
Create a custom temporary password.
Delete a custom temporary password.
Update a custom temporary password.
Get the list of active temporary passwords.
Get the list of invalid temporary passwords
Clear the list of invalid temporary passwords
Freeze the specified custom temporary password.
Unfreeze the specified custom temporary password.
Rename the temporary password
Save an online unlimited-use password
Delete an online unlimited-use password
Get the list of online unlimited-use passwords
Create an offline temporary password.
Get the list of valid offline passwords
Get the list of expired offline passwords
Create a time-limited temporary password
Create a single-use temporary password
Create a dynamic temporary password.
Create an offline password clear code
Get clearable time-limited password list
Check whether (Wi‑Fi) remote unlocking is currently allowed.
Unlock
Lock
Enable or disable the remote lock/unlock feature
Get remote lock/unlock enablement status
Get current remote open/close door permissions
Update the remote open/close door permission policy
Approve remote door-open request (used by Wi‑Fi Pro solution)
Reject remote door-open request (Wi‑Fi Pro and similar confirmation flows)
Check whether the voice unlock passcode capability is enabled
Disable the voice unlock passcode capability
Update the voice unlock passcode
Register for log-refresh notifications
Unregister the log-refresh notification
Get the most recent 2 records
Get log record list
Get alarm log list
Get album logs
Get device log list
Supports operation logs, unlock logs, lock logs, and alarm logs
Get the number of unread alerts
Get valid security days (since device activation)
Get device signal strength
Get Wi-Fi signal strength
Subscribe to Wi‑Fi signal changes
Unsubscribe from Wi‑Fi signal changes
Whether currently in sleep mode
Check whether the lock supports the sleep feature
Check whether the sleep feature is enabled
Enable the sleep feature
Disable the sleep feature
Get the sleep time range
Set the sleep time range
Register sleep-state change event
Unregister sleep-state change event
Open the Smart Scene page
Check whether Bluetooth control is supported
Get the current value of a time-range DP
Update the time range of a time-range DP
Initiate the near-field/LAN device connection flow.
Navigate to host pages such as Value-added Services/Cloud Storage.
Validate password complexity per product rules.
Set/toggle the gesture password (if a password already exists, you can toggle it directly without the native panel).
Get the actual playback URL of a video
Whether media capabilities (video/snapshot, etc.) are supported.
Get the device camera rotation angle
Get device camera data
Open local album
Open the playback/cruise monitoring panel
Whether multi-camera switching is supported
Get camera info
Query camera info
Switch the camera to the specified index
Get this month's media view count
Set this month's media view count
Get the list of dates with album records in the last 30 days
Get information for all cameras
Get voice file list
Deliver the voice file to the device
Subscribe to voice file delivery progress
Unsubscribe from voice file delivery progress
Get current voice file status
Get doorbell notification service info
Enable the doorbell notification service
Disable the doorbell notification service
Go to configure the doorbell notification service
Whether a certain `ProductCommunicationType` capability is supported.
Whether the current device is a pure Bluetooth lock (no Wi‑Fi/Thread or other communication capabilities).
Fetch the device value‑added capability list (cloud).
Synchronously retrieve the list of device value-added capabilities
Get device capabilities
Get the pending AI monthly report; returns null if disabled or none available.
Mark the AI monthly report as read (to prevent duplicate pop-ups).
Whether the AI data report is enabled (cloud capability ai_data_report && device property LOCK_UNLOCK_REPORT).
Bind an accessory to the current door lock.
Unbind the accessory from the current door lock.
Get the list of accessories currently bound to the lock.
Get the list of accessories that can be bound to the current lock.
Get the paginated list of activity events for the current detached screen.
Get the list of locks currently bound to the detached screen.
Get the list of locks that can be bound to the current detached screen.
Initiate binding the specified lock to the current detached screen.
Subscribe to the result of binding a lock to the detached screen.
Unsubscribe from the result of binding a lock to the detached screen (must use the same reference as in subscribe).
Remove the specified binding relation and return after the unbinding result converges in the cloud.
Get the list of locks bound to the current accessory; each item includes a security version compatibility check
Get the list of locks that can be bound to the current accessory; each item includes a bindability check
Bind the lock to the current accessory
Unbind the lock from the current accessory
Activate a bound lock device
Add a password on the accessory side
Start a multi-stage process on the accessory side to add an unlock method (fingerprint/card/face, etc.)
Cancel the in-progress add-unlock-method process on the accessory side
Register an accessory-side listener for add-unlock-method steps
Unregister the accessory-side listener for add-unlock-method steps
Update an unlock method on the accessory side (cloud-only)
Delete an unlock method on the accessory side
Get the list of unlock methods of the specified type for the accessory.
Initiate unlock-method synchronization.
Get the accessory's Bluetooth key list.
Add a Bluetooth key on the accessory side.
Create a permanent Bluetooth key on the accessory side
Create a temporary Bluetooth key on the accessory side
Update the temporary Bluetooth key on the accessory side (rename/change the validity period)
Delete a Bluetooth key on the accessory side.
Rename a Bluetooth key on the accessory side.
Get the member (user) list for the accessory.
Get the accessory's door open/close record list
Get the current accessory's online password list.
Get the current accessory's online password details list (retaining original fields such as opModeType/effective period/phone number/lock name).
Get the list of valid offline temporary passwords for the current accessory.
Add a temporary password on the accessory.
Delete a temporary password on the accessory.
Modify a temporary password on the accessory.
Rename a temporary password on the accessory.
Rename an offline temporary password on the accessory (cloud-only).
Delete an offline temporary password on the accessory: generate a 'clear code' (cloud-only).
Resend the temporary password SMS.
Retrieve the list of expired passwords for the accessory.
Clear the accessory's expired passwords.
Get the current accessory's dynamic password (short-term validity; usable multiple times within 5 minutes).
Get the current accessory's one-time offline password
Get the current accessory's time-limited offline password
Generate the 'Clear All' erase code
Get the list of offline passwords that can be "cleared individually" (time-limited offline passwords used at least once).
Check whether a given type of offline password for the current accessory can still be obtained (one-time/clear codes limited to 10 per hour).
typeDpValueUnion of primitive DP payload values
string | boolean | number
enumRemotePermissionType
ValueActual ValueDescription
RemotePermissionType.EVERY_ONEeveryOneEveryone allowed
RemotePermissionType.ADMINS_ONLYadminsOnlyAdmins only
RemotePermissionType.NO_ONEnoOneNo one allowed
enumProductCommunicationType
ValueActual ValueDescription
ProductCommunicationType.WIFI0-
ProductCommunicationType.CABLE1-
ProductCommunicationType.GPRS2-
ProductCommunicationType.NB_IOT3-
ProductCommunicationType.BLUETOOTH10-
ProductCommunicationType.BLE_MESH11-
ProductCommunicationType.ZIGBEE12-
ProductCommunicationType.INFRARED13-
ProductCommunicationType.SUBPIECES14-
ProductCommunicationType.SIGMESH15-
ProductCommunicationType.MCU16-
ProductCommunicationType.TY_SMESH17-
ProductCommunicationType.ZWAVE18-
ProductCommunicationType.PL_MESH19-
ProductCommunicationType.CAT120-
ProductCommunicationType.BEACON21-
ProductCommunicationType.CAT422-
ProductCommunicationType.CAT1023-
ProductCommunicationType.LTE_CATM24-
ProductCommunicationType.THREAD25-
typeWeekWeekly repeat bitmap: indices 0–6 correspond to Sun–Sat; 0 inactive, 1 active
export type Week = [
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
];
enumUserType
ValueActual ValueDescription
UserType.ADMIN10Administrator
UserType.MEMBER20Member
UserType.UNKNOW30Anonymous
UserType.SHARE40Shared member
UserType.OWNER50Home owner

Valid Values

SDKOptions.logLevel
ValueDescriptionSince
off--
error--
warn--
info--
debug--
trace--
SDKOptions.kind
ValueDescriptionSince
lock--
fit--
screen--
UpdateConfigParams.logLevel
ValueDescriptionSince
off--
error--
warn--
info--
debug--
trace--
UpdateConfigParams.kind
ValueDescriptionSince
lock--
fit--
screen--
DeviceStatus.type
ValueDescriptionSince
offline--
online--
sleep--
DeviceStatus.onlineTypes
ValueDescriptionSince
local--
cloud--
ble--
localMatter--
yuChannel--
unknown--
Week
ValueDescriptionSince
0--
1--
UserInfo.unlockDetails.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
UserType
ValueDescriptionSince
10Administrator-
20Member-
30Anonymous-
40Shared member-
50Home owner-
EffectiveConfig.repeat
ValueDescriptionSince
none--
week--
AddSharedUserParams.effectiveType
ValueDescriptionSince
once--
permanent--
limit--
UpdateSharedUserParams.effectiveType
ValueDescriptionSince
once--
permanent--
limit--
StartAddUnlockMethodParams.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
CancelAddUnlockMethodParams.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
BindUnlockMethodParams.unlockList.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
BindUnlockMethodFromLogParams.unlockList.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
RemotePermissionType
ValueDescriptionSince
everyOneEveryone allowed-
adminsOnlyAdmins only-
noOneNo one allowed-
GetLockLogListParams.logCategories
ValueDescriptionSince
operation--
unlock_record--
close_record--
alarm_record--
OpenSceneOptions.executorRange
ValueDescriptionSince
unlock--
lock--
OpenSceneOptions.abilities
ValueDescriptionSince
backHome--
alarm--
geographyArrive--
geographyLeave--
bleGeofence--
siriUnlock--
siriLock--
GotoServiceParams.tab
ValueDescriptionSince
cloudStorage--
AI--
voip--
GotoPlaybackParams.tabs
ValueDescriptionSince
local--
cloud--
ProductCommunicationType
ValueDescriptionSince
0--
1--
2--
3--
10--
11--
12--
13--
14--
15--
16--
17--
18--
19--
20--
21--
22--
23--
24--
25--
FitStartAddUnlockMethodParams.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
FitCancelAddUnlockMethodParams.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
GetFitUnlockMethodListParams.type
ValueDescriptionSince
finger--
face--
password--
card--
fingerVein--
hand--
eye--
AddFitTempPwdParams.type
ValueDescriptionSince
once--
limit--

Examples

Create a separate instance per lock device

import { createSDK } from '@ray-js/lock-sdk';
const a = await createSDK({ deviceId: 'devA' });
const b = await createSDK({ deviceId: 'devB' });
await a.openDoor();

Accessory instance

const fit = await createSDK({ deviceId: 'devFit', kind: 'fit' });