resetFactory

Requires:
DeviceKit≥1.3.0@ray-js/ray≥0.6.23
Platforms:
iOSAndroid
import { device } from '@ray-js/ray';

const { resetFactory } = device;

// Promise usage
try {
  const res = await resetFactory({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Method signature
resetFactory(params: )
Minimum SDK versions
iOSThingSmartDeviceKitBizBundle
≥ 5.2.0
Androidcom.thingclips.smart:thingsmart-bizbundle-devicekit
≥ 5.2.0

Description

Reset the device to factory settings. Device data will be cleared and it will enter an awaiting provisioning state.

Parameters

PropertyTypeRequiredDescriptionMinimum SDK versions
deviceIdstringYesdeviceId device ID Supports fetching other devices’ information across panels; the current panel can pass the current device’s ID to retrieve it—
dpsRecord<string, Record<string, any>>Nodps—
complete() => voidNoCompletion callback (executed on both success and failure)—
success() => voidNoCallback on successful API call—
fail(params: Object) => voidNoFailure callback—
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { device } from '@ray-js/ray'

device.resetFactory({
  deviceId: "xx",
  dps: { "xx": {} },
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});