Skip to content

Commit 73ec80c

Browse files
candeodevelopmentautofix-ci[bot]Koenkk
authored
fix: Candeo C204, C-ZB-DM204, C205 & C-ZB-SM205-2G: various improvements (#9033)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Koen Kanters <[email protected]>
1 parent 8fc8350 commit 73ec80c

File tree

1 file changed

+66
-9
lines changed

1 file changed

+66
-9
lines changed

src/devices/candeo.ts

+66-9
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ const tzLocal = {
5858

5959
export const definitions: DefinitionWithExtend[] = [
6060
{
61-
zigbeeModel: ["C205"],
61+
fingerprint: [{modelID: "C205", manufacturerName: "Candeo"}],
6262
model: "C205",
6363
vendor: "Candeo",
64-
description: "Switch module",
65-
extend: [m.onOff({powerOnBehavior: false})],
64+
description: "Zigbee switch module",
65+
extend: [m.onOff()],
66+
fromZigbee: [fzLocal.switch_type, fz.ignore_genOta],
67+
toZigbee: [tzLocal.switch_type],
68+
exposes: [e.enum("external_switch_type", ea.ALL, ["momentary", "toggle"]).withLabel("External switch type")],
69+
configure: async (device, coordinatorEndpoint, logger) => {
70+
const endpoint1 = device.getEndpoint(1);
71+
await endpoint1.write("genOnOff", {16387: {value: 0xff, type: 0x30}});
72+
await endpoint1.read("genOnOff", ["startUpOnOff"]);
73+
await endpoint1.read("genBasic", [switchTypeAttribute], {manufacturerCode: manufacturerSpecificClusterCode});
74+
},
6675
},
6776
{
6877
zigbeeModel: ["HK-DIM-A", "Candeo Zigbee Dimmer", "HK_DIM_A"],
@@ -83,18 +92,54 @@ export const definitions: DefinitionWithExtend[] = [
8392
extend: [m.light({configureReporting: true})],
8493
},
8594
{
86-
zigbeeModel: ["C204"],
95+
fingerprint: [{modelID: "C204", manufacturerName: "Candeo"}],
8796
model: "C204",
8897
vendor: "Candeo",
8998
description: "Zigbee micro smart dimmer",
90-
extend: [m.light({configureReporting: true}), m.electricityMeter()],
99+
extend: [
100+
m.light({configureReporting: true, levelConfig: {disabledFeatures: ["on_transition_time", "off_transition_time", "execute_if_off"]}}),
101+
m.electricityMeter(),
102+
],
103+
fromZigbee: [fzLocal.switch_type, fz.ignore_genOta],
104+
toZigbee: [tzLocal.switch_type],
105+
exposes: [e.enum("external_switch_type", ea.ALL, ["momentary", "toggle"]).withLabel("External switch type")],
106+
configure: async (device, coordinatorEndpoint, logger) => {
107+
const endpoint1 = device.getEndpoint(1);
108+
await endpoint1.write("genOnOff", {16387: {value: 0xff, type: 0x30}});
109+
await endpoint1.read("genOnOff", ["startUpOnOff"]);
110+
await endpoint1.write("genLevelCtrl", {17: {value: 0xff, type: 0x20}});
111+
await endpoint1.read("genLevelCtrl", ["onLevel"]);
112+
await endpoint1.write("genLevelCtrl", {16: {value: 0x0a, type: 0x21}});
113+
await endpoint1.read("genLevelCtrl", ["onOffTransitionTime"]);
114+
await endpoint1.write("genLevelCtrl", {16384: {value: 0xff, type: 0x20}});
115+
await endpoint1.read("genLevelCtrl", ["startUpCurrentLevel"]);
116+
await endpoint1.read("genBasic", [switchTypeAttribute], {manufacturerCode: manufacturerSpecificClusterCode});
117+
},
91118
},
92119
{
93-
zigbeeModel: ["C-ZB-DM204"],
120+
fingerprint: [{modelID: "C-ZB-DM204", manufacturerName: "Candeo"}],
94121
model: "C-ZB-DM204",
95122
vendor: "Candeo",
96123
description: "Zigbee micro smart dimmer",
97-
extend: [m.light({configureReporting: true}), m.electricityMeter()],
124+
extend: [
125+
m.light({configureReporting: true, levelConfig: {disabledFeatures: ["on_transition_time", "off_transition_time", "execute_if_off"]}}),
126+
m.electricityMeter(),
127+
],
128+
fromZigbee: [fzLocal.switch_type, fz.ignore_genOta],
129+
toZigbee: [tzLocal.switch_type],
130+
exposes: [e.enum("external_switch_type", ea.ALL, ["momentary", "toggle"]).withLabel("External switch type")],
131+
configure: async (device, coordinatorEndpoint, logger) => {
132+
const endpoint1 = device.getEndpoint(1);
133+
await endpoint1.write("genOnOff", {16387: {value: 0xff, type: 0x30}});
134+
await endpoint1.read("genOnOff", ["startUpOnOff"]);
135+
await endpoint1.write("genLevelCtrl", {17: {value: 0xff, type: 0x20}});
136+
await endpoint1.read("genLevelCtrl", ["onLevel"]);
137+
await endpoint1.write("genLevelCtrl", {16: {value: 0x0a, type: 0x21}});
138+
await endpoint1.read("genLevelCtrl", ["onOffTransitionTime"]);
139+
await endpoint1.write("genLevelCtrl", {16384: {value: 0xff, type: 0x20}});
140+
await endpoint1.read("genLevelCtrl", ["startUpCurrentLevel"]);
141+
await endpoint1.read("genBasic", [switchTypeAttribute], {manufacturerCode: manufacturerSpecificClusterCode});
142+
},
98143
},
99144
{
100145
zigbeeModel: ["C202"],
@@ -219,13 +264,26 @@ export const definitions: DefinitionWithExtend[] = [
219264
description: "Smart 2 gang switch module",
220265
extend: [
221266
m.deviceEndpoints({
222-
endpoints: {l1: 1, l2: 2},
267+
endpoints: {l1: 1, l2: 2, e11: 11},
223268
multiEndpointSkip: ["power", "current", "voltage", "energy"],
224269
}),
225270
m.onOff({endpointNames: ["l1", "l2"]}),
226271
m.electricityMeter(),
227272
],
273+
fromZigbee: [fzLocal.switch_type, fz.ignore_genOta],
274+
toZigbee: [tzLocal.switch_type],
275+
exposes: [e.enum("external_switch_type", ea.ALL, ["momentary", "toggle"]).withLabel("External switch type").withEndpoint("e11")],
228276
meta: {},
277+
configure: async (device, coordinatorEndpoint, logger) => {
278+
const endpoint1 = device.getEndpoint(1);
279+
const endpoint2 = device.getEndpoint(2);
280+
await endpoint1.write("genOnOff", {16387: {value: 0xff, type: 0x30}});
281+
await endpoint1.read("genOnOff", [16387]);
282+
await endpoint2.write("genOnOff", {16387: {value: 0xff, type: 0x30}});
283+
await endpoint2.read("genOnOff", [16387]);
284+
const endpoint11 = device.getEndpoint(11);
285+
await endpoint11.read("genBasic", [switchTypeAttribute], {manufacturerCode: manufacturerSpecificClusterCode});
286+
},
229287
},
230288
{
231289
fingerprint: [{modelID: "C-RFZB-SM1"}],
@@ -252,7 +310,6 @@ export const definitions: DefinitionWithExtend[] = [
252310
const endpoint1 = device.getEndpoint(1);
253311
await endpoint1.write("genOnOff", {16387: {value: 0xff, type: 0x30}});
254312
await endpoint1.read("genOnOff", ["startUpOnOff"]);
255-
await endpoint1.read("genLevelCtrl", ["currentLevel"]);
256313
await endpoint1.write("genLevelCtrl", {17: {value: 0xff, type: 0x20}});
257314
await endpoint1.read("genLevelCtrl", ["onLevel"]);
258315
await endpoint1.write("genLevelCtrl", {16: {value: 0x0a, type: 0x21}});

0 commit comments

Comments
 (0)