Real-Time Adjustment Protocol

Last Updated on : 2021-12-16 03:11:44download


ControlDataFormatter is a class method used to parse and reversely parse data points (DPs) for real-time lighting adjustment. The parse method can be called to parse the hexadecimal strings reported by firmware into data structures required by device panels. The format method can be called to reversely parse object data into hexadecimal strings in line with generic protocols for colored light.

API methods


Type Required Description
String Yes The hexadecimal string.


Type Required Description
Object Yes The object of the IControllData class.
declare interface IControllData {
  mode: number;
  hue: number;
  saturation: number;
  value: number;
  brightness: number;
  temperature: number;


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

const { SupportUtils } = Utils;
const { ControlDataFormatter } = Formatter;

const d = new ControlDataFormatter()


    mode: 1,
    hue: 0,
    saturation: 0,
    value: 0,
    brightness: 1000,
    temperature: 1000,