@@ -28615,63 +28615,63 @@ export const definitions: DefinitionWithExtend[] = [
2861528615 },
2861628616 },
2861728617 {
28618- fingerprint: tuya.fingerprint("TS0601", ["_TZE284_oa1odmga"]),
28619- model: "TS0601_floodlight",
28620- vendor: "Tuya",
28621- description: "Smart RGBCW floodlight",
28622- fromZigbee: [tuya.fz.datapoints],
28623- toZigbee: [tuya.tz.datapoints],
28624- configure: tuya.configureMagicPacket,
28625- exposes: [e.light().withBrightness().withColorTemp([153, 500]).withColor(["hs"])],
28626- meta: {
28627- tuyaDatapoints: [
28628- [1, "state", tuya.valueConverter.onOff],
28629- // Standard Tuya light DP layout puts a work_mode enum on DP2 -
28630- // writing a brightness number there gets silently ignored.
28631- [
28632- 2,
28633- "work_mode",
28634- tuya.valueConverterBasic.lookup({
28635- white: tuya.enum(0),
28636- colour: tuya.enum(1),
28637- scene: tuya.enum(2),
28638- music: tuya.enum(3),
28639- }),
28640- ],
28641- // Brightness is 0-1000 on the device but 0-254 in Z2M.
28642- [3, "brightness", tuya.valueConverter.scale0_254to0_1000],
28643- [4, "color_temp", tuya.valueConverter.raw],
28644- [
28645- 5,
28646- "color",
28647- {
28648- to: (value) => {
28649- // The exposed 'hs' composite uses the property
28650- // names 'hue' and 'saturation', not 'h' and 's'.
28651- if (value.hue !== undefined && value.saturation !== undefined) {
28652- const hue = Math.round(value.hue);
28653- const sat = Math.round(value.saturation * 10); // 0-100 -> 0-1000
28654- // Keep current brightness (V) instead of forcing full,
28655- // fall back to full brightness if we don't know it yet.
28656- const val = value.brightness !== undefined ? Math.round(value.brightness * 10) : 1000;
28657- const hHex = hue.toString(16).padStart(4, "0");
28658- const sHex = sat.toString(16).padStart(4, "0");
28659- const vHex = val.toString(16).padStart(4, "0");
28660- return hHex + sHex + vHex;
28661- }
28662- return value;
28663- },
28664- from: (value) => {
28665- if (typeof value === "string" && value.length >= 12) {
28666- const hue = Number.parseInt(value.substring(0, 4), 16);
28667- const saturation = Number.parseInt(value.substring(4, 8), 16) / 10;
28668- return {hue, saturation};
28669- }
28670- return value;
28618+ fingerprint: tuya.fingerprint("TS0601", ["_TZE284_oa1odmga"]),
28619+ model: "TS0601_floodlight",
28620+ vendor: "Tuya",
28621+ description: "Smart RGBCW floodlight",
28622+ fromZigbee: [tuya.fz.datapoints],
28623+ toZigbee: [tuya.tz.datapoints],
28624+ configure: tuya.configureMagicPacket,
28625+ exposes: [e.light().withBrightness().withColorTemp([153, 500]).withColor(["hs"])],
28626+ meta: {
28627+ tuyaDatapoints: [
28628+ [1, "state", tuya.valueConverter.onOff],
28629+ // Standard Tuya light DP layout puts a work_mode enum on DP2 -
28630+ // writing a brightness number there gets silently ignored.
28631+ [
28632+ 2,
28633+ "work_mode",
28634+ tuya.valueConverterBasic.lookup({
28635+ white: tuya.enum(0),
28636+ colour: tuya.enum(1),
28637+ scene: tuya.enum(2),
28638+ music: tuya.enum(3),
28639+ }),
28640+ ],
28641+ // Brightness is 0-1000 on the device but 0-254 in Z2M.
28642+ [3, "brightness", tuya.valueConverter.scale0_254to0_1000],
28643+ [4, "color_temp", tuya.valueConverter.raw],
28644+ [
28645+ 5,
28646+ "color",
28647+ {
28648+ to: (value) => {
28649+ // The exposed 'hs' composite uses the property
28650+ // names 'hue' and 'saturation', not 'h' and 's'.
28651+ if (value.hue !== undefined && value.saturation !== undefined) {
28652+ const hue = Math.round(value.hue);
28653+ const sat = Math.round(value.saturation * 10); // 0-100 -> 0-1000
28654+ // Keep current brightness (V) instead of forcing full,
28655+ // fall back to full brightness if we don't know it yet.
28656+ const val = value.brightness !== undefined ? Math.round(value.brightness * 10) : 1000;
28657+ const hHex = hue.toString(16).padStart(4, "0");
28658+ const sHex = sat.toString(16).padStart(4, "0");
28659+ const vHex = val.toString(16).padStart(4, "0");
28660+ return hHex + sHex + vHex;
28661+ }
28662+ return value;
28663+ },
28664+ from: (value) => {
28665+ if (typeof value === "string" && value.length >= 12) {
28666+ const hue = Number.parseInt(value.substring(0, 4), 16);
28667+ const saturation = Number.parseInt(value.substring(4, 8), 16) / 10;
28668+ return {hue, saturation};
28669+ }
28670+ return value;
28671+ },
2867128672 },
28672- } ,
28673+ ] ,
2867328674 ],
28674- ] ,
28675+ } ,
2867528676 },
28676- },
2867728677];
0 commit comments