getDeviceProperty

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

const { getDeviceProperty } = device;

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

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

Description

Get device properties

Parameters

PropertyTypeRequiredDescriptionMinimum SDK versions
deviceIdstringYesdeviceId Device ID Supports retrieving other device information across panels. The current panel can pass the current device ID to fetch it—
dpsRecord<string, Record<string, any>>Nodps—
complete() => voidNoCompletion callback (executed on both success and failure)—
success(params: Object) => voidNoCallback on successful API call—
fail(params: Object) => voidNoFailure callback—
success callback parameters
PropertyTypeDescriptionDeviceKit SinceMinimum SDK versions
propertiesRecord<string, Record<string, any>>Device attribute key-value pairsv3.3.0—
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

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

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