Docs / iglooworks / BLE SDK / Lock & Unlock
Lock & Unlock
Control Igloohome smart locks via BLE.
lock
Locks the device via Bluetooth. Optionally sets the lock's internal clock before locking.
Signature
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceId |
String |
Yes | Bluetooth device name of the lock (e.g. "IGM4-XXXX"). |
key |
String |
Yes | Guest key for BLE authentication. Required permission: LOCK. |
timeInSeconds |
Long? |
No | Unix timestamp (seconds) to set on the lock before locking. If omitted, the SDK uses the last server time if available. |
operationId |
Int? |
No | Operation ID for tracking the BLE command in activity logs. |
Error Codes
| Exception | Code | Description |
|---|---|---|
BluetoothException |
708 | Bluetooth is off or unavailable. |
ConnectionException |
12 | BLE connection failed or device disconnected. |
TimeoutException |
703 | Operation exceeded the 15-second BLE timeout. |
GenericException |
1 | Any other unhandled error. |
On iOS, lock/unlock throw LockManagerError directly — see Error Reference.
Example
unlock
Unlocks the device via Bluetooth. Optionally sets the lock's internal clock before unlocking.
Signature
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceId |
String |
Yes | Bluetooth device name of the lock. |
key |
String |
Yes | Guest key for BLE authentication. Required permission: UNLOCK. |
timeInSeconds |
Long? |
No | Unix timestamp (seconds) to set on the lock before unlocking. |
operationId |
Int? |
No | Operation ID for tracking the BLE command in activity logs. |
Error Codes
| Exception | Code | Description |
|---|---|---|
BluetoothException |
708 | Bluetooth is off or unavailable. |
ConnectionException |
12 | BLE connection failed or device disconnected. |
TimeoutException |
703 | Operation exceeded the 15-second BLE timeout. |
GenericException |
1 | Any other unhandled error. |
Example
disconnect
Closes the BLE connection to a specific lock. Safe to call even if not connected.
Signature
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceId |
String |
Yes | Bluetooth device name of the lock to disconnect from. |
Example
disconnectAll
Closes all active BLE connections.
Signature
Example
Notes
- The default BLE timeout is 15 seconds for lock/unlock operations.
- The SDK automatically connects to the lock when
lock()orunlock()is called — there is no separateconnect()method. - Always call
disconnect()ordisconnectAll()when done to free BLE resources. On iOS, calldisconnect(_:)for each device you connected to. - If the lock disconnects during an operation,
ConnectionException(Android) /LockManagerError.deviceDisconnected(iOS) is thrown immediately.