Skip to content

Commit 0e5475b

Browse files
feat(add): KD-R01D (#8896)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent fb51ace commit 0e5475b

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed

src/devices/lumi.ts

+57
Original file line numberDiff line numberDiff line change
@@ -4521,4 +4521,61 @@ export const definitions: DefinitionWithExtend[] = [
45214521
lumiMultiClick({description: "Multi-click mode for right down button", endpointName: "right_down"}),
45224522
],
45234523
},
4524+
{
4525+
zigbeeModel: ["lumi.switch.agl011"],
4526+
model: "KD-R01D",
4527+
vendor: "Aqara",
4528+
description: "Dimmer switch H2 EU",
4529+
extend: [
4530+
lumiZigbeeOTA(),
4531+
lumiPreventLeave(),
4532+
m.bindCluster({cluster: "genOnOff", clusterType: "input"}),
4533+
m.bindCluster({cluster: "genLevelCtrl", clusterType: "input"}),
4534+
lumiPower(),
4535+
lumiElectricityMeter(),
4536+
lumiLedIndicator(),
4537+
lumiFlipIndicatorLight(),
4538+
lumiPowerOnBehavior(),
4539+
m.light({powerOnBehavior: false}),
4540+
lumiKnobRotation({withButtonState: false}),
4541+
lumiOperationMode({description: "Decoupled mode for knob"}),
4542+
lumiAction({actionLookup: {single: 1}}),
4543+
m.enumLookup({
4544+
name: "sensitivity",
4545+
lookup: {low: 720, medium: 360, high: 180},
4546+
cluster: "manuSpecificLumi",
4547+
attribute: {ID: 0x0234, type: 0x21},
4548+
description: "Rotation sensitivity",
4549+
zigbeeCommandOptions: {manufacturerCode},
4550+
}),
4551+
m.enumLookup({
4552+
name: "phase",
4553+
lookup: {forward: 0, reverse: 1},
4554+
cluster: "manuSpecificLumi",
4555+
attribute: {ID: 0x030a, type: 0x20},
4556+
description: "Dimming phase",
4557+
zigbeeCommandOptions: {manufacturerCode},
4558+
}),
4559+
m.numeric({
4560+
name: "min_brightness",
4561+
valueMin: 0,
4562+
valueMax: 99,
4563+
unit: "%",
4564+
cluster: "manuSpecificLumi",
4565+
attribute: {ID: 0x0515, type: 0x20},
4566+
description: "Minimum brightness level",
4567+
zigbeeCommandOptions: {manufacturerCode},
4568+
}),
4569+
m.numeric({
4570+
name: "max_brightness",
4571+
valueMin: 1,
4572+
valueMax: 100,
4573+
unit: "%",
4574+
cluster: "manuSpecificLumi",
4575+
attribute: {ID: 0x0516, type: 0x20},
4576+
description: "Maximum brightness level",
4577+
zigbeeCommandOptions: {manufacturerCode},
4578+
}),
4579+
],
4580+
},
45244581
];

src/lib/lumi.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,10 @@ export const numericAttributes2Payload = async (msg: Fz.Message, meta: Fz.Meta,
497497
payload.consumption = payload.energy;
498498
break;
499499
case "150":
500-
if (!["JTYJ-GD-01LM/BW"].includes(model.model)) {
500+
if (["KD-R01D"].includes(model.model)) {
501+
assertNumber(value);
502+
payload.voltage = value * 0.01;
503+
} else if (!["JTYJ-GD-01LM/BW"].includes(model.model)) {
501504
assertNumber(value);
502505
payload.voltage = value * 0.1; // 0x96
503506
}
@@ -2126,19 +2129,24 @@ export const lumiModernExtend = {
21262129

21272130
return {exposes, fromZigbee, isModernExtend: true};
21282131
},
2129-
lumiKnobRotation: (): ModernExtend => {
2132+
lumiKnobRotation: (args?: {withButtonState: boolean}): ModernExtend => {
2133+
const withButtonState = args?.withButtonState || true;
21302134
const exposes: Expose[] = [
21312135
e.action(["start_rotating", "rotation", "stop_rotating"]),
2132-
e
2133-
.enum("action_rotation_button_state", ea.STATE, ["released", "pressed"])
2134-
.withDescription("Button state during rotation")
2135-
.withCategory("diagnostic"),
21362136
e.numeric("action_rotation_angle", ea.STATE).withUnit("*").withDescription("Rotation angle").withCategory("diagnostic"),
21372137
e.numeric("action_rotation_angle_speed", ea.STATE).withUnit("*").withDescription("Rotation angle speed").withCategory("diagnostic"),
21382138
e.numeric("action_rotation_percent", ea.STATE).withUnit("%").withDescription("Rotation percent").withCategory("diagnostic"),
21392139
e.numeric("action_rotation_percent_speed", ea.STATE).withUnit("%").withDescription("Rotation percent speed").withCategory("diagnostic"),
21402140
e.numeric("action_rotation_time", ea.STATE).withUnit("ms").withDescription("Rotation time").withCategory("diagnostic"),
21412141
];
2142+
if (withButtonState) {
2143+
exposes.push(
2144+
e
2145+
.enum("action_rotation_button_state", ea.STATE, ["released", "pressed"])
2146+
.withDescription("Button state during rotation")
2147+
.withCategory("diagnostic"),
2148+
);
2149+
}
21422150

21432151
const fromZigbee: Fz.Converter[] = [
21442152
{

0 commit comments

Comments
 (0)