setGroupProperty(params: Object)

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

const { setGroupProperty } = device;

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

Description

Set group attributes

Parameters

PropertyTypeRequiredDescription
groupIdstringYesGroup ID
codestringYesGroup attribute code; you can query the corresponding attribute definition on the Tuya IoT Platform
valuestringYesAttribute value; the attribute's setting value corresponding to the code
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.setGroupProperty({
  groupId: "xx",
  code: "xx",
  value: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});