Skip to content

Commit 9724032

Browse files
feat: Tuya TS0601_dimmer_3: expose backlight brightness and color (#11188)
Co-authored-by: KarolKalita <karol@retailsolution.pl>
1 parent 2f4c0d7 commit 9724032

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/devices/tuya.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,6 +3865,14 @@ export const definitions: DefinitionWithExtend[] = [
38653865
tuya.exposes.lightType().withEndpoint("l3"),
38663866
e.power_on_behavior().withAccess(ea.STATE_SET),
38673867
tuya.exposes.backlightModeOffNormalInverted().withAccess(ea.STATE_SET),
3868+
e.enum("backlight_color", ea.ALL, Object.keys(tuya.BacklightColorEnum)).withDescription("Backlight color"),
3869+
e
3870+
.numeric("backlight_brightness", ea.ALL)
3871+
.withValueMin(0)
3872+
.withValueMax(100)
3873+
.withUnit("%")
3874+
.withValueStep(1)
3875+
.withDescription("Backlight brightness"),
38683876
],
38693877
meta: {
38703878
multiEndpoint: true,
@@ -3889,6 +3897,8 @@ export const definitions: DefinitionWithExtend[] = [
38893897
[19, "max_brightness_l3", tuya.valueConverter.scale0_254to0_1000],
38903898
[20, "countdown_l3", tuya.valueConverter.countdown],
38913899
[21, "backlight_mode", tuya.valueConverter.backlightModeOffNormalInverted],
3900+
[101, "backlight_color", tuya.valueConverterBasic.lookup(tuya.BacklightColorEnum)],
3901+
[103, "backlight_brightness", tuya.valueConverter.raw],
38923902
],
38933903
},
38943904
endpoint: (device) => {

src/lib/tuya.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,17 @@ export class Enum extends Base {}
436436
const enumConstructor = (value: number) => new Enum(value);
437437
export {enumConstructor as enum};
438438

439+
export const BacklightColorEnum = {
440+
red: enumConstructor(0),
441+
blue: enumConstructor(1),
442+
green: enumConstructor(2),
443+
white: enumConstructor(3),
444+
yellow: enumConstructor(4),
445+
magenta: enumConstructor(5),
446+
cyan: enumConstructor(6),
447+
warm_white: enumConstructor(7),
448+
} as const;
449+
439450
export class Bitmap extends Base {}
440451

441452
type LookupMap = {[s: string]: number | boolean | Enum | string};

0 commit comments

Comments
 (0)