Lighting Feature Utility Class

Last Updated on : 2023-12-18 06:18:12download

Installation

yarn add @tuya/tuya-panel-lamp-sdk

Use

import { Utils } from '@tuya/tuya-panel-lamp-sdk';

const { isSupportBright } = Utils.SupportUtils;

Use cases

Method Feature Parameter Value type Remarks
isGroupDevice Specifies whether a group device is used. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportBright Specifies whether to support the white color brightness. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportTemp Specifies whether to support color temperature. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportColour Specifies whether to support the colored mode. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportScene Specifies whether to support smart scenes. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportMusic Specifies whether to support app music. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportCountdown Specifies whether to support the countdown. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportRhythm Specifies whether to support biorhythm. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportWhite Specifies whether to support the colored mode. (isForce = false) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportWorkMode Specifies whether to support the specified work mode. (code: string) Boolean isForce: specifies whether the value is not obtained from the cache.
isSupportDp Specifies whether to support the specified DP. (dpCode: string, isForce = false) Boolean dpCode: the data point (DP) name.
isForce: specifies whether the value is not obtained from the cache.
isZigbeeDevice Specifies whether to support Zigbee capabilities. null Boolean
isSignMeshDivice Specifies whether to support Bluetooth mesh capabilities. null Boolean
isWifiDivice Specifies whether to support Wi-Fi capabilities. null Boolean
hasCapability Specifies whether a certain capability is supported. (id:number) Boolean id: the device capability bit.

Values of device capabilities

capability: the capability type of the device.

Type Wi-Fi Bluetooth LE Zigbee Bluetooth mesh Beacon
Number of binary digits 0 10 12 15 21

Example

import { Utils } from '@tuya/tuya-panel-lamp-sdk';

Utils.SupportUtils.isGroupDevice();  // true/false

Utils.SupportUtils.isSupportBright();  // true/false

Utils.SupportUtils.isSupportTemp();  // true/false

Utils.SupportUtils.isSupportColour();  // true/false

Utils.SupportUtils.isSupportScene();  // true/false

Utils.SupportUtils.isSupportMusic();  // true/false

Utils.SupportUtils.isSupportCountdown();  // true/false

Utils.SupportUtils.isSupportRhythm();  // true/false

Utils.SupportUtils.isSupportWhite();  // true/false

/** Specifies whether to support the white light mode.*/
Utils.SupportUtils.isSupportWorkMode('music');  // true/false

 /** Specifies whether to support the colored mode. */
Utils.SupportUtils.isSupportDp('color_data');  // true/false

Utils.SupportUtils.isZigbeeDevice();  // true/false

Utils.SupportUtils.isWifiDivice();  // true/false

/** Specifies whether the Wi-Fi capability is enabled.  */
Utils.SupportUtils.hasCapability(0);  // true/false