zigbee-herdsman-converters 23.26.0 → 23.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/converters/toZigbee.js +1 -1
  3. package/dist/converters/toZigbee.js.map +1 -1
  4. package/dist/devices/bosch.js +1 -1
  5. package/dist/devices/bosch.js.map +1 -1
  6. package/dist/devices/efekta.js +2 -2
  7. package/dist/devices/efekta.js.map +1 -1
  8. package/dist/devices/gledopto.js +1 -1
  9. package/dist/devices/gledopto.js.map +1 -1
  10. package/dist/devices/gmmts.js +1 -1
  11. package/dist/devices/gmmts.js.map +1 -1
  12. package/dist/devices/heiman.d.ts.map +1 -1
  13. package/dist/devices/heiman.js +7 -0
  14. package/dist/devices/heiman.js.map +1 -1
  15. package/dist/devices/ikea.js +1 -1
  16. package/dist/devices/ikea.js.map +1 -1
  17. package/dist/devices/inovelli.js +15 -15
  18. package/dist/devices/inovelli.js.map +1 -1
  19. package/dist/devices/ledvance.d.ts.map +1 -1
  20. package/dist/devices/ledvance.js +7 -0
  21. package/dist/devices/ledvance.js.map +1 -1
  22. package/dist/devices/lincukoo.d.ts.map +1 -1
  23. package/dist/devices/lincukoo.js +11 -5
  24. package/dist/devices/lincukoo.js.map +1 -1
  25. package/dist/devices/lixee.js +1 -1
  26. package/dist/devices/namron.js +1 -1
  27. package/dist/devices/namron.js.map +1 -1
  28. package/dist/devices/paulmann.js +1 -1
  29. package/dist/devices/paulmann.js.map +1 -1
  30. package/dist/devices/qoto.js +1 -1
  31. package/dist/devices/qoto.js.map +1 -1
  32. package/dist/devices/sber.d.ts.map +1 -1
  33. package/dist/devices/sber.js +773 -0
  34. package/dist/devices/sber.js.map +1 -1
  35. package/dist/devices/sonoff.d.ts.map +1 -1
  36. package/dist/devices/sonoff.js +63 -1
  37. package/dist/devices/sonoff.js.map +1 -1
  38. package/dist/devices/tech.js +2 -2
  39. package/dist/devices/tech.js.map +1 -1
  40. package/dist/devices/tuya.d.ts.map +1 -1
  41. package/dist/devices/tuya.js +34 -16
  42. package/dist/devices/tuya.js.map +1 -1
  43. package/dist/devices/vimar.js +1 -1
  44. package/dist/devices/yandex.js +1 -1
  45. package/dist/devices/yandex.js.map +1 -1
  46. package/dist/devices/yokis.js +8 -8
  47. package/dist/devices/yokis.js.map +1 -1
  48. package/dist/lib/develco.js +1 -1
  49. package/dist/lib/develco.js.map +1 -1
  50. package/dist/lib/ewelink.js +8 -8
  51. package/dist/lib/ewelink.js.map +1 -1
  52. package/dist/lib/exposes.d.ts +2 -0
  53. package/dist/lib/exposes.d.ts.map +1 -1
  54. package/dist/lib/exposes.js +7 -0
  55. package/dist/lib/exposes.js.map +1 -1
  56. package/dist/lib/ikea.d.ts.map +1 -1
  57. package/dist/lib/ikea.js +87 -1
  58. package/dist/lib/ikea.js.map +1 -1
  59. package/dist/lib/lumi.js +4 -4
  60. package/dist/lib/lumi.js.map +1 -1
  61. package/dist/lib/modernExtend.js +2 -2
  62. package/dist/lib/modernExtend.js.map +1 -1
  63. package/dist/lib/utils.js +1 -1
  64. package/dist/lib/utils.js.map +1 -1
  65. package/dist/models-index.json +1 -1
  66. package/package.json +1 -1
@@ -34,9 +34,523 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.definitions = void 0;
37
+ const zigbee_herdsman_1 = require("zigbee-herdsman");
38
+ const fz = __importStar(require("../converters/fromZigbee"));
39
+ const tz = __importStar(require("../converters/toZigbee"));
40
+ const exposes = __importStar(require("../lib/exposes"));
37
41
  const m = __importStar(require("../lib/modernExtend"));
42
+ const reporting = __importStar(require("../lib/reporting"));
38
43
  const tuya = __importStar(require("../lib/tuya"));
44
+ const utils = __importStar(require("../lib/utils"));
45
+ const e = exposes.presets;
46
+ const ea = exposes.access;
47
+ const NS = "zhc:sdevices";
39
48
  const { tuyaMagicPacket, tuyaOnOffActionLegacy } = tuya.modernExtend;
49
+ const manufacturerOptions = { manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.SBERDEVICES_LTD };
50
+ const defaultResponseOptions = { disableDefaultResponse: false };
51
+ const sdevices = {
52
+ fz: {
53
+ emergency_shutoff_state: {
54
+ cluster: "manuSpecificSDevices",
55
+ type: ["attributeReport", "readResponse"],
56
+ convert: (model, msg, publish, options, meta) => {
57
+ if (msg.data.emergencyShutoffState !== undefined) {
58
+ const stateBitmap = msg.data.emergencyShutoffState;
59
+ const emergencyOvervoltage = stateBitmap & 0x01;
60
+ const emergencyUndervoltage = (stateBitmap & 0x02) >>> 1;
61
+ const emergencyOvercurrent = (stateBitmap & 0x04) >>> 2;
62
+ const emergencyOverheat = (stateBitmap & 0x08) >>> 3;
63
+ return {
64
+ emergency_overvoltage: !!emergencyOvervoltage,
65
+ emergency_undervoltage: !!emergencyUndervoltage,
66
+ emergency_overcurrent: !!emergencyOvercurrent,
67
+ emergency_overheat: !!emergencyOverheat,
68
+ };
69
+ }
70
+ },
71
+ },
72
+ led_indicator_settings: {
73
+ cluster: "manuSpecificSDevices",
74
+ type: ["attributeReport", "readResponse"],
75
+ convert: (model, msg, publish, options, meta) => {
76
+ const result = {};
77
+ if (msg.data.ledIndicatorOnEnable !== undefined) {
78
+ result[utils.postfixWithEndpointName("led_indicator_on_enable", msg, model, meta)] = msg.data.ledIndicatorOnEnable ? "ON" : "OFF";
79
+ }
80
+ if (msg.data.ledIndicatorOnH !== undefined) {
81
+ result[utils.postfixWithEndpointName("led_indicator_on_h", msg, model, meta)] = msg.data.ledIndicatorOnH;
82
+ }
83
+ if (msg.data.ledIndicatorOnS !== undefined) {
84
+ result[utils.postfixWithEndpointName("led_indicator_on_s", msg, model, meta)] = msg.data.ledIndicatorOnS;
85
+ }
86
+ if (msg.data.ledIndicatorOnB !== undefined) {
87
+ result[utils.postfixWithEndpointName("led_indicator_on_b", msg, model, meta)] = msg.data.ledIndicatorOnB;
88
+ }
89
+ if (msg.data.ledIndicatorOffEnable !== undefined) {
90
+ result[utils.postfixWithEndpointName("led_indicator_off_enable", msg, model, meta)] = msg.data.ledIndicatorOffEnable
91
+ ? "ON"
92
+ : "OFF";
93
+ }
94
+ if (msg.data.ledIndicatorOffH !== undefined) {
95
+ result[utils.postfixWithEndpointName("led_indicator_off_h", msg, model, meta)] = msg.data.ledIndicatorOffH;
96
+ }
97
+ if (msg.data.ledIndicatorOffS !== undefined) {
98
+ result[utils.postfixWithEndpointName("led_indicator_off_s", msg, model, meta)] = msg.data.ledIndicatorOffS;
99
+ }
100
+ if (msg.data.ledIndicatorOffB !== undefined) {
101
+ result[utils.postfixWithEndpointName("led_indicator_off_b", msg, model, meta)] = msg.data.ledIndicatorOffB;
102
+ }
103
+ return result;
104
+ },
105
+ },
106
+ multistate_input: {
107
+ cluster: "genMultistateInput",
108
+ type: ["attributeReport"],
109
+ convert: (model, msg, publish, options, meta) => {
110
+ const actionLookup = { 0: "hold", 1: "single", 2: "double" };
111
+ const value = msg.data.presentValue;
112
+ const action = actionLookup[value];
113
+ return { action: utils.postfixWithEndpointName(action, msg, model, meta) };
114
+ },
115
+ },
116
+ decouple_relay: {
117
+ cluster: "genOnOff",
118
+ type: ["attributeReport", "readResponse"],
119
+ convert: (model, msg, publish, options, meta) => {
120
+ const state = {};
121
+ if (msg.data.sdevicesRelayDecouple !== undefined) {
122
+ const relayDecoupleLookup = { 0: "control_relay", 1: "decoupled" };
123
+ state[utils.postfixWithEndpointName("relay_mode", msg, model, meta)] = utils.getFromLookup(msg.data.sdevicesRelayDecouple, relayDecoupleLookup);
124
+ }
125
+ return state;
126
+ },
127
+ },
128
+ allow_double_click: {
129
+ cluster: "manuSpecificSDevices",
130
+ type: ["attributeReport", "readResponse"],
131
+ convert: (model, msg, publish, options, meta) => {
132
+ const result = {};
133
+ if (msg.data.buttonEnableMultiClick !== undefined) {
134
+ result[utils.postfixWithEndpointName("allow_double_click", msg, model, meta)] = msg.data.buttonEnableMultiClick ? "ON" : "OFF";
135
+ }
136
+ return result;
137
+ },
138
+ },
139
+ },
140
+ tz: {
141
+ custom_on_off: {
142
+ ...tz.on_off,
143
+ key: ["state"],
144
+ },
145
+ led_indicator_on_settings: {
146
+ key: ["led_indicator_on_enable", "led_indicator_on_h", "led_indicator_on_s", "led_indicator_on_b"],
147
+ convertSet: async (entity, key, value, meta) => {
148
+ utils.assertString(key);
149
+ const payload = {};
150
+ switch (key) {
151
+ case "led_indicator_on_enable":
152
+ utils.assertString(value);
153
+ payload.ledIndicatorOnEnable = value.toUpperCase() === "ON" ? 1 : 0;
154
+ break;
155
+ case "led_indicator_on_h":
156
+ payload.ledIndicatorOnH = value;
157
+ break;
158
+ case "led_indicator_on_s":
159
+ payload.ledIndicatorOnS = value;
160
+ break;
161
+ case "led_indicator_on_b":
162
+ payload.ledIndicatorOnB = value;
163
+ break;
164
+ }
165
+ await m.determineEndpoint(entity, meta, "manuSpecificSDevices").write("manuSpecificSDevices", payload, defaultResponseOptions);
166
+ return { state: { [key]: value } };
167
+ },
168
+ convertGet: async (entity, key, meta) => {
169
+ await m
170
+ .determineEndpoint(entity, meta, "manuSpecificSDevices")
171
+ .read("manuSpecificSDevices", ["ledIndicatorOnEnable", "ledIndicatorOnH", "ledIndicatorOnS", "ledIndicatorOnB"], defaultResponseOptions);
172
+ },
173
+ },
174
+ led_indicator_off_settings: {
175
+ key: ["led_indicator_off_enable", "led_indicator_off_h", "led_indicator_off_s", "led_indicator_off_b"],
176
+ convertSet: async (entity, key, value, meta) => {
177
+ utils.assertString(key);
178
+ const payload = {};
179
+ switch (key) {
180
+ case "led_indicator_off_enable":
181
+ utils.assertString(value);
182
+ payload.ledIndicatorOffEnable = value.toUpperCase() === "ON" ? 1 : 0;
183
+ break;
184
+ case "led_indicator_off_h":
185
+ payload.ledIndicatorOffH = value;
186
+ break;
187
+ case "led_indicator_off_s":
188
+ payload.ledIndicatorOffS = value;
189
+ break;
190
+ case "led_indicator_off_b":
191
+ payload.ledIndicatorOffB = value;
192
+ break;
193
+ }
194
+ await m.determineEndpoint(entity, meta, "manuSpecificSDevices").write("manuSpecificSDevices", payload, defaultResponseOptions);
195
+ return { state: { [key]: value } };
196
+ },
197
+ convertGet: async (entity, key, meta) => {
198
+ await m
199
+ .determineEndpoint(entity, meta, "manuSpecificSDevices")
200
+ .read("manuSpecificSDevices", ["ledIndicatorOffEnable", "ledIndicatorOffH", "ledIndicatorOffS", "ledIndicatorOffB"], defaultResponseOptions);
201
+ },
202
+ },
203
+ identify: {
204
+ key: ["identify"],
205
+ options: tz.identify.options,
206
+ convertSet: async (entity, key, value, meta) => {
207
+ const identifyTimeout = meta.options.identify_timeout ?? 30;
208
+ await entity.command("genIdentify", "identify", { identifytime: identifyTimeout }, utils.getOptions(meta.mapped, entity));
209
+ },
210
+ },
211
+ decouple_relay: {
212
+ key: ["relay_mode"],
213
+ convertSet: async (entity, key, value, meta) => {
214
+ if (typeof value !== "string") {
215
+ return;
216
+ }
217
+ const relayDecoupleLookup = { control_relay: 0, decoupled: 1 };
218
+ if (relayDecoupleLookup[value] === undefined) {
219
+ throw new Error(`relay_mode was called with an invalid value (${value})`);
220
+ }
221
+ utils.assertEndpoint(entity);
222
+ await utils
223
+ .enforceEndpoint(entity, key, meta)
224
+ .write("genOnOff", { sdevicesRelayDecouple: relayDecoupleLookup[value] }, manufacturerOptions);
225
+ return { state: { relay_mode: value.toLowerCase() } };
226
+ },
227
+ convertGet: async (entity, key, meta) => {
228
+ utils.assertEndpoint(entity);
229
+ await utils.enforceEndpoint(entity, key, meta).read("genOnOff", ["sdevicesRelayDecouple"], manufacturerOptions);
230
+ },
231
+ },
232
+ allow_double_click: {
233
+ key: ["allow_double_click"],
234
+ convertSet: async (entity, key, value, meta) => {
235
+ if (typeof value !== "string") {
236
+ return;
237
+ }
238
+ const payload = {};
239
+ payload.buttonEnableMultiClick = value.toUpperCase() === "ON" ? 1 : 0;
240
+ await m.determineEndpoint(entity, meta, "manuSpecificSDevices").write("manuSpecificSDevices", payload, defaultResponseOptions);
241
+ return { state: { [key]: value } };
242
+ },
243
+ convertGet: async (entity, key, meta) => {
244
+ await m
245
+ .determineEndpoint(entity, meta, "manuSpecificSDevices")
246
+ .read("manuSpecificSDevices", ["buttonEnableMultiClick"], defaultResponseOptions);
247
+ },
248
+ },
249
+ },
250
+ };
251
+ const sdevicesCustomClusterDefinition = {
252
+ ID: 0xfccf,
253
+ manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.SBERDEVICES_LTD,
254
+ attributes: {
255
+ buttonEnableMultiClick: { ID: 0x1002, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN },
256
+ childLock: { ID: 0x1003, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN },
257
+ ledIndicatorOnEnable: { ID: 0x2001, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN },
258
+ ledIndicatorOnH: { ID: 0x2002, type: zigbee_herdsman_1.Zcl.DataType.UINT16 },
259
+ ledIndicatorOnS: { ID: 0x2003, type: zigbee_herdsman_1.Zcl.DataType.UINT8 },
260
+ ledIndicatorOnB: { ID: 0x2004, type: zigbee_herdsman_1.Zcl.DataType.UINT8 },
261
+ ledIndicatorOffEnable: { ID: 0x2005, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN },
262
+ ledIndicatorOffH: { ID: 0x2006, type: zigbee_herdsman_1.Zcl.DataType.UINT16 },
263
+ ledIndicatorOffS: { ID: 0x2007, type: zigbee_herdsman_1.Zcl.DataType.UINT8 },
264
+ ledIndicatorOffB: { ID: 0x2008, type: zigbee_herdsman_1.Zcl.DataType.UINT8 },
265
+ emergencyShutoffState: { ID: 0x3001, type: zigbee_herdsman_1.Zcl.DataType.BITMAP16 },
266
+ emergencyShutoffRecovery: { ID: 0x3002, type: zigbee_herdsman_1.Zcl.DataType.BITMAP16 },
267
+ upperVoltageThreshold: { ID: 0x3011, type: zigbee_herdsman_1.Zcl.DataType.UINT32 },
268
+ lowerVoltageThreshold: { ID: 0x3012, type: zigbee_herdsman_1.Zcl.DataType.UINT32 },
269
+ upperCurrentThreshold: { ID: 0x3013, type: zigbee_herdsman_1.Zcl.DataType.UINT32 },
270
+ upperTempThreshold: { ID: 0x3014, type: zigbee_herdsman_1.Zcl.DataType.INT16 },
271
+ rmsVoltageMv: { ID: 0x4001, type: zigbee_herdsman_1.Zcl.DataType.UINT32 },
272
+ rmsCurrentMa: { ID: 0x4002, type: zigbee_herdsman_1.Zcl.DataType.UINT32 },
273
+ activePowerMw: { ID: 0x4003, type: zigbee_herdsman_1.Zcl.DataType.INT32 },
274
+ },
275
+ commands: {},
276
+ commandsResponse: {},
277
+ };
278
+ const sdevicesExtend = {
279
+ sdevicesCustomCluster: () => m.deviceAddCustomCluster("manuSpecificSDevices", sdevicesCustomClusterDefinition),
280
+ genOnOffCluster: () => m.deviceAddCustomCluster("genOnOff", {
281
+ ID: zigbee_herdsman_1.Zcl.Clusters.genOnOff.ID,
282
+ attributes: {
283
+ sdevicesRelayDecouple: { ID: 0x10dc, type: zigbee_herdsman_1.Zcl.DataType.BOOLEAN, manufacturerCode: zigbee_herdsman_1.Zcl.ManufacturerCode.SBERDEVICES_LTD },
284
+ },
285
+ commands: {},
286
+ commandsResponse: {},
287
+ }),
288
+ onOffRelayDecouple: (args) => m.enumLookup({
289
+ name: "relay_mode",
290
+ description: "Decoupled mode for button",
291
+ cluster: "genOnOff",
292
+ attribute: "sdevicesRelayDecouple",
293
+ lookup: { control_relay: 0, decoupled: 1 },
294
+ zigbeeCommandOptions: manufacturerOptions,
295
+ ...args,
296
+ }),
297
+ ledIndicatorSettings: () => {
298
+ const fromZigbee = [
299
+ {
300
+ cluster: "manuSpecificSDevices",
301
+ type: ["attributeReport", "readResponse"],
302
+ convert: (model, msg, publish, options, meta) => {
303
+ const result = {};
304
+ if (msg.data.ledIndicatorOnEnable !== undefined) {
305
+ result.led_indicator_on_enable = msg.data.ledIndicatorOnEnable ? "ON" : "OFF";
306
+ }
307
+ if (msg.data.ledIndicatorOnH !== undefined) {
308
+ result.led_indicator_on_h = msg.data.ledIndicatorOnH;
309
+ }
310
+ if (msg.data.ledIndicatorOnS !== undefined) {
311
+ result.led_indicator_on_s = msg.data.ledIndicatorOnS;
312
+ }
313
+ if (msg.data.ledIndicatorOnB !== undefined) {
314
+ result.led_indicator_on_b = msg.data.ledIndicatorOnB;
315
+ }
316
+ if (msg.data.ledIndicatorOffEnable !== undefined) {
317
+ result.led_indicator_off_enable = msg.data.ledIndicatorOffEnable ? "ON" : "OFF";
318
+ }
319
+ if (msg.data.ledIndicatorOffH !== undefined) {
320
+ result.led_indicator_off_h = msg.data.ledIndicatorOffH;
321
+ }
322
+ if (msg.data.ledIndicatorOffS !== undefined) {
323
+ result.led_indicator_off_s = msg.data.ledIndicatorOffS;
324
+ }
325
+ if (msg.data.ledIndicatorOffB !== undefined) {
326
+ result.led_indicator_off_b = msg.data.ledIndicatorOffB;
327
+ }
328
+ return result;
329
+ },
330
+ },
331
+ ];
332
+ const toZigbee = [
333
+ {
334
+ key: ["led_indicator_on_enable", "led_indicator_on_h", "led_indicator_on_s", "led_indicator_on_b"],
335
+ convertSet: async (entity, key, value, meta) => {
336
+ const payload = {};
337
+ switch (key) {
338
+ case "led_indicator_on_enable":
339
+ utils.assertString(value);
340
+ payload.ledIndicatorOnEnable = value.toUpperCase() === "ON" ? 1 : 0;
341
+ break;
342
+ case "led_indicator_on_h":
343
+ payload.ledIndicatorOnH = value;
344
+ break;
345
+ case "led_indicator_on_s":
346
+ payload.ledIndicatorOnS = value;
347
+ break;
348
+ case "led_indicator_on_b":
349
+ payload.ledIndicatorOnB = value;
350
+ break;
351
+ }
352
+ await entity.write("manuSpecificSDevices", payload, defaultResponseOptions);
353
+ return { state: { [key]: value } };
354
+ },
355
+ convertGet: async (entity, key, meta) => {
356
+ await entity.read("manuSpecificSDevices", ["ledIndicatorOnEnable", "ledIndicatorOnH", "ledIndicatorOnS", "ledIndicatorOnB"], defaultResponseOptions);
357
+ },
358
+ },
359
+ {
360
+ key: ["led_indicator_off_enable", "led_indicator_off_h", "led_indicator_off_s", "led_indicator_off_b"],
361
+ convertSet: async (entity, key, value, meta) => {
362
+ const payload = {};
363
+ switch (key) {
364
+ case "led_indicator_off_enable":
365
+ utils.assertString(value);
366
+ payload.ledIndicatorOffEnable = value.toUpperCase() === "ON" ? 1 : 0;
367
+ break;
368
+ case "led_indicator_off_h":
369
+ payload.ledIndicatorOffH = value;
370
+ break;
371
+ case "led_indicator_off_s":
372
+ payload.ledIndicatorOffS = value;
373
+ break;
374
+ case "led_indicator_off_b":
375
+ payload.ledIndicatorOffB = value;
376
+ break;
377
+ }
378
+ await entity.write("manuSpecificSDevices", payload, defaultResponseOptions);
379
+ return { state: { [key]: value } };
380
+ },
381
+ convertGet: async (entity, key, meta) => {
382
+ await entity.read("manuSpecificSDevices", ["ledIndicatorOffEnable", "ledIndicatorOffH", "ledIndicatorOffS", "ledIndicatorOffB"], defaultResponseOptions);
383
+ },
384
+ },
385
+ ];
386
+ const exposes = [
387
+ e
388
+ .binary("led_indicator_on_enable", ea.ALL, "ON", "OFF")
389
+ .withLabel("LED indication")
390
+ .withDescription("Is LED indicator enabled in ON state"),
391
+ e
392
+ .numeric("led_indicator_on_h", ea.ALL)
393
+ .withUnit("°")
394
+ .withValueMin(0)
395
+ .withValueMax(359)
396
+ .withLabel("Hue")
397
+ .withDescription("Hue of LED in ON state"),
398
+ e
399
+ .numeric("led_indicator_on_s", ea.ALL)
400
+ .withValueMin(0)
401
+ .withValueMax(0xfe)
402
+ .withLabel("Saturation")
403
+ .withDescription("Saturation of LED in ON state"),
404
+ e
405
+ .numeric("led_indicator_on_b", ea.ALL)
406
+ .withValueMin(1)
407
+ .withValueMax(0xfe)
408
+ .withLabel("Brightness")
409
+ .withDescription("Brightness of LED in ON state"),
410
+ e
411
+ .binary("led_indicator_off_enable", ea.ALL, "ON", "OFF")
412
+ .withLabel("LED indication")
413
+ .withDescription("Is LED indicator enabled in OFF state"),
414
+ e
415
+ .numeric("led_indicator_off_h", ea.ALL)
416
+ .withUnit("°")
417
+ .withValueMin(0)
418
+ .withValueMax(359)
419
+ .withLabel("Hue")
420
+ .withDescription("Hue of LED in OFF state"),
421
+ e
422
+ .numeric("led_indicator_off_s", ea.ALL)
423
+ .withValueMin(0)
424
+ .withValueMax(0xfe)
425
+ .withLabel("Saturation")
426
+ .withDescription("Saturation of LED in OFF state"),
427
+ e
428
+ .numeric("led_indicator_off_b", ea.ALL)
429
+ .withValueMin(1)
430
+ .withValueMax(0xfe)
431
+ .withLabel("Brightness")
432
+ .withDescription("Brightness of LED in OFF state"),
433
+ ];
434
+ return { exposes, fromZigbee, toZigbee, isModernExtend: true };
435
+ },
436
+ electricityMeter: () => {
437
+ const exposes = [e.voltage().withAccess(ea.STATE_GET), e.current().withAccess(ea.STATE_GET), e.power().withAccess(ea.STATE_GET)];
438
+ const fromZigbee = [
439
+ {
440
+ cluster: "manuSpecificSDevices",
441
+ type: ["attributeReport", "readResponse"],
442
+ convert: (model, msg, publish, options, meta) => {
443
+ if (utils.hasAlreadyProcessedMessage(msg, model))
444
+ return;
445
+ const lookup = [
446
+ { key: "rmsVoltageMv", name: "voltage", multiplier: 0.001 },
447
+ { key: "rmsCurrentMa", name: "current", multiplier: 0.001 },
448
+ { key: "activePowerMw", name: "power", multiplier: 0.001 },
449
+ ];
450
+ const payload = {};
451
+ for (const entry of lookup) {
452
+ if (msg.data[entry.key] !== undefined) {
453
+ const value = msg.data[entry.key] * entry.multiplier;
454
+ payload[entry.name] = value;
455
+ }
456
+ }
457
+ return payload;
458
+ },
459
+ },
460
+ ];
461
+ const toZigbee = [
462
+ {
463
+ key: ["voltage"],
464
+ convertGet: async (entity, key, meta) => {
465
+ await entity.read("manuSpecificSDevices", ["rmsVoltageMv"]);
466
+ },
467
+ },
468
+ {
469
+ key: ["current"],
470
+ convertGet: async (entity, key, meta) => {
471
+ await entity.read("manuSpecificSDevices", ["rmsCurrentMa"]);
472
+ },
473
+ },
474
+ {
475
+ key: ["power"],
476
+ convertGet: async (entity, key, meta) => {
477
+ await entity.read("manuSpecificSDevices", ["activePowerMw"]);
478
+ },
479
+ },
480
+ ];
481
+ return { exposes, fromZigbee, toZigbee, isModernExtend: true };
482
+ },
483
+ childLock: () => m.binary({
484
+ name: "child_lock",
485
+ cluster: "manuSpecificSDevices",
486
+ attribute: "childLock",
487
+ description: "Enable child lock to prevent manual button operation",
488
+ valueOn: ["ON", 0x01],
489
+ valueOff: ["OFF", 0x00],
490
+ zigbeeCommandOptions: manufacturerOptions,
491
+ }),
492
+ deviceTemperature: () => m.numeric({
493
+ name: "device_temperature",
494
+ cluster: "genDeviceTempCfg",
495
+ attribute: "currentTemperature",
496
+ description: "Temperature of the device",
497
+ unit: "°C",
498
+ access: "STATE_GET",
499
+ entityCategory: "diagnostic",
500
+ }),
501
+ emergencyShutoffRecovery: () => m.enumLookup({
502
+ name: "emergency_shutoff_recovery",
503
+ cluster: "manuSpecificSDevices",
504
+ attribute: "emergencyShutoffRecovery",
505
+ description: "Condition of automatic recovery after emergency shutoff",
506
+ lookup: { disabled: 0, voltage_is_good: 1 },
507
+ zigbeeCommandOptions: manufacturerOptions,
508
+ }),
509
+ upperVoltageThreshold: () => m.numeric({
510
+ name: "upper_voltage_threshold",
511
+ cluster: "manuSpecificSDevices",
512
+ attribute: "upperVoltageThreshold",
513
+ description: "Upper voltage threshold",
514
+ valueMin: 230000,
515
+ valueMax: 260000,
516
+ valueStep: 1000,
517
+ unit: "mV",
518
+ zigbeeCommandOptions: manufacturerOptions,
519
+ }),
520
+ lowerVoltageThreshold: () => m.numeric({
521
+ name: "lower_voltage_threshold",
522
+ cluster: "manuSpecificSDevices",
523
+ attribute: "lowerVoltageThreshold",
524
+ description: "Lower voltage threshold (use with caution)",
525
+ valueMin: 100000,
526
+ valueMax: 230000,
527
+ valueStep: 1000,
528
+ unit: "mV",
529
+ zigbeeCommandOptions: manufacturerOptions,
530
+ }),
531
+ upperCurrentThreshold: () => m.numeric({
532
+ name: "upper_current_threshold",
533
+ cluster: "manuSpecificSDevices",
534
+ attribute: "upperCurrentThreshold",
535
+ description: "Upper current threshold",
536
+ valueMin: 100,
537
+ valueMax: 16000,
538
+ valueStep: 100,
539
+ unit: "mA",
540
+ zigbeeCommandOptions: manufacturerOptions,
541
+ }),
542
+ temperatureThreshold: () => m.numeric({
543
+ name: "temperature_threshold",
544
+ cluster: "manuSpecificSDevices",
545
+ attribute: "upperTempThreshold",
546
+ description: "Overtemperature threshold (use with caution)",
547
+ valueMin: -200,
548
+ valueMax: 200,
549
+ valueStep: 1,
550
+ unit: "°C",
551
+ zigbeeCommandOptions: manufacturerOptions,
552
+ }),
553
+ };
40
554
  exports.definitions = [
41
555
  {
42
556
  fingerprint: tuya.fingerprint("SM0202", ["_TYZB01_2jzbhomb"]),
@@ -94,5 +608,264 @@ exports.definitions = [
94
608
  m.battery(),
95
609
  ],
96
610
  },
611
+ {
612
+ fingerprint: [{ modelID: "SBDV-00196", manufacturerName: "SDevices" }],
613
+ model: "SBDV-00196",
614
+ vendor: "Sber",
615
+ description: "Smart Wall Switch (with neutral, single button)",
616
+ fromZigbee: [fz.on_off, fz.power_on_behavior],
617
+ toZigbee: [sdevices.tz.custom_on_off, tz.power_on_behavior],
618
+ exposes: [e.switch(), e.power_on_behavior(["off", "on", "toggle", "previous"])],
619
+ extend: [
620
+ sdevicesExtend.sdevicesCustomCluster(),
621
+ sdevicesExtend.genOnOffCluster(),
622
+ m.binary({
623
+ name: "allow_double_click",
624
+ cluster: "manuSpecificSDevices",
625
+ attribute: "buttonEnableMultiClick",
626
+ description: "Allow detection of double clicks, may introduce delay in reaction when enabled",
627
+ valueOn: ["ON", 0x01],
628
+ valueOff: ["OFF", 0x00],
629
+ zigbeeCommandOptions: manufacturerOptions,
630
+ }),
631
+ sdevicesExtend.ledIndicatorSettings(),
632
+ m.identify(),
633
+ sdevicesExtend.onOffRelayDecouple({
634
+ name: "relay_mode",
635
+ description: "Decoupled mode for button",
636
+ }),
637
+ m.actionEnumLookup({
638
+ cluster: "genMultistateInput",
639
+ attribute: "presentValue",
640
+ actionLookup: { hold: 0, single: 1, double: 2 },
641
+ }),
642
+ ],
643
+ ota: true,
644
+ configure: async (device, coordinatorEndpoint) => {
645
+ await device.getEndpoint(1).read("genOnOff", ["onOff", "startUpOnOff"]);
646
+ await device.getEndpoint(1).read("genBasic", ["serialNumber"]);
647
+ await device
648
+ .getEndpoint(1)
649
+ .read("manuSpecificSDevices", [
650
+ "ledIndicatorOnEnable",
651
+ "ledIndicatorOnH",
652
+ "ledIndicatorOnS",
653
+ "ledIndicatorOnB",
654
+ "ledIndicatorOffEnable",
655
+ "ledIndicatorOffH",
656
+ "ledIndicatorOffS",
657
+ "ledIndicatorOffB",
658
+ ]);
659
+ await device.getEndpoint(1).read("manuSpecificSDevices", ["buttonEnableMultiClick"]);
660
+ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ["genOnOff", "genMultistateInput"]);
661
+ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ["haDiagnostic"]);
662
+ },
663
+ },
664
+ {
665
+ fingerprint: [{ modelID: "SBDV-00199", manufacturerName: "SDevices" }],
666
+ model: "SBDV-00199",
667
+ vendor: "Sber",
668
+ description: "Smart Wall Switch (with neutral, two buttons)",
669
+ fromZigbee: [
670
+ fz.on_off,
671
+ fz.power_on_behavior,
672
+ sdevices.fz.multistate_input,
673
+ sdevices.fz.led_indicator_settings,
674
+ sdevices.fz.decouple_relay,
675
+ sdevices.fz.allow_double_click,
676
+ ],
677
+ toZigbee: [
678
+ sdevices.tz.custom_on_off,
679
+ tz.power_on_behavior,
680
+ sdevices.tz.identify,
681
+ sdevices.tz.led_indicator_on_settings,
682
+ sdevices.tz.led_indicator_off_settings,
683
+ sdevices.tz.decouple_relay,
684
+ sdevices.tz.allow_double_click,
685
+ ],
686
+ exposes: (device, options) => {
687
+ const switchExposes = [];
688
+ const endpointsCount = 2;
689
+ switchExposes.push(e.action(["hold_switch_1", "hold_switch_2", "single_switch_1", "single_switch_2", "double_switch_1", "double_switch_2"]));
690
+ for (let i = 1; i <= endpointsCount; i++) {
691
+ const epName = `switch_${i}`;
692
+ const epPrefix = `(${i}) `;
693
+ switchExposes.push(e.switch().withEndpoint(epName));
694
+ switchExposes.push(e.power_on_behavior(["off", "on", "toggle", "previous"]).withLabel(`${epPrefix}Power-on behavior`).withEndpoint(epName));
695
+ switchExposes.push(e
696
+ .enum("relay_mode", ea.ALL, ["control_relay", "decoupled"])
697
+ .withLabel(`${epPrefix}Relay mode`)
698
+ .withDescription("Decoupled mode")
699
+ .withEndpoint(epName));
700
+ switchExposes.push(e
701
+ .binary("allow_double_click", ea.ALL, "ON", "OFF")
702
+ .withLabel(`${epPrefix}Allow double clicks`)
703
+ .withDescription("Allow detection of double clicks, may introduce delay in reaction when enabled")
704
+ .withEndpoint(epName));
705
+ switchExposes.push(e
706
+ .enum("identify", ea.SET, ["identify"])
707
+ .withLabel(`${epPrefix}Identify`)
708
+ .withDescription("Initiate device identification")
709
+ .withCategory("config")
710
+ .withEndpoint(epName));
711
+ switchExposes.push(e
712
+ .binary("led_indicator_on_enable", ea.ALL, "ON", "OFF")
713
+ .withLabel(`${epPrefix}LED indication`)
714
+ .withDescription("Is LED indicator enabled in ON state")
715
+ .withEndpoint(epName));
716
+ switchExposes.push(e
717
+ .numeric("led_indicator_on_h", ea.ALL)
718
+ .withUnit("°")
719
+ .withValueMin(0)
720
+ .withValueMax(359)
721
+ .withLabel(`${epPrefix}Hue`)
722
+ .withDescription("Hue of LED in ON state")
723
+ .withEndpoint(epName));
724
+ switchExposes.push(e
725
+ .numeric("led_indicator_on_s", ea.ALL)
726
+ .withValueMin(0)
727
+ .withValueMax(0xfe)
728
+ .withLabel(`${epPrefix}Saturation`)
729
+ .withDescription("Saturation of LED in ON state")
730
+ .withEndpoint(epName));
731
+ switchExposes.push(e
732
+ .numeric("led_indicator_on_b", ea.ALL)
733
+ .withValueMin(1)
734
+ .withValueMax(0xfe)
735
+ .withLabel(`${epPrefix}Brightness`)
736
+ .withDescription("Brightness of LED in ON state")
737
+ .withEndpoint(epName));
738
+ switchExposes.push(e
739
+ .binary("led_indicator_off_enable", ea.ALL, "ON", "OFF")
740
+ .withLabel(`${epPrefix}LED indication`)
741
+ .withDescription("Is LED indicator enabled in OFF state")
742
+ .withEndpoint(epName));
743
+ switchExposes.push(e
744
+ .numeric("led_indicator_off_h", ea.ALL)
745
+ .withUnit("°")
746
+ .withValueMin(0)
747
+ .withValueMax(359)
748
+ .withLabel(`${epPrefix}Hue`)
749
+ .withDescription("Hue of LED in OFF state")
750
+ .withEndpoint(epName));
751
+ switchExposes.push(e
752
+ .numeric("led_indicator_off_s", ea.ALL)
753
+ .withValueMin(0)
754
+ .withValueMax(0xfe)
755
+ .withLabel(`${epPrefix}Saturation`)
756
+ .withDescription("Saturation of LED in OFF state")
757
+ .withEndpoint(epName));
758
+ switchExposes.push(e
759
+ .numeric("led_indicator_off_b", ea.ALL)
760
+ .withValueMin(1)
761
+ .withValueMax(0xfe)
762
+ .withLabel(`${epPrefix}Brightness`)
763
+ .withDescription("Brightness of LED in OFF state")
764
+ .withEndpoint(epName));
765
+ }
766
+ return [...switchExposes];
767
+ },
768
+ extend: [
769
+ sdevicesExtend.sdevicesCustomCluster(),
770
+ sdevicesExtend.genOnOffCluster(),
771
+ m.deviceEndpoints({ endpoints: { switch_1: 1, switch_2: 2 } }),
772
+ ],
773
+ ota: true,
774
+ configure: async (device, coordinatorEndpoint) => {
775
+ if (!device.customClusters.manuSpecificSDevices) {
776
+ device.addCustomCluster("manuSpecificSDevices", sdevicesCustomClusterDefinition);
777
+ }
778
+ await device.getEndpoint(1).read("genBasic", ["serialNumber"]);
779
+ await device.getEndpoint(1).read("genOnOff", ["onOff", "startUpOnOff"]);
780
+ await device.getEndpoint(2).read("genOnOff", ["onOff", "startUpOnOff"]);
781
+ await device.getEndpoint(1).read("genOnOff", ["sdevicesRelayDecouple"], manufacturerOptions);
782
+ await device.getEndpoint(2).read("genOnOff", ["sdevicesRelayDecouple"], manufacturerOptions);
783
+ await device
784
+ .getEndpoint(1)
785
+ .read("manuSpecificSDevices", [
786
+ "buttonEnableMultiClick",
787
+ "ledIndicatorOnEnable",
788
+ "ledIndicatorOnH",
789
+ "ledIndicatorOnS",
790
+ "ledIndicatorOnB",
791
+ "ledIndicatorOffEnable",
792
+ "ledIndicatorOffH",
793
+ "ledIndicatorOffS",
794
+ "ledIndicatorOffB",
795
+ ], manufacturerOptions);
796
+ await device
797
+ .getEndpoint(2)
798
+ .read("manuSpecificSDevices", [
799
+ "buttonEnableMultiClick",
800
+ "ledIndicatorOnEnable",
801
+ "ledIndicatorOnH",
802
+ "ledIndicatorOnS",
803
+ "ledIndicatorOnB",
804
+ "ledIndicatorOffEnable",
805
+ "ledIndicatorOffH",
806
+ "ledIndicatorOffS",
807
+ "ledIndicatorOffB",
808
+ ], manufacturerOptions);
809
+ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ["genOnOff", "genMultistateInput"]);
810
+ await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ["genOnOff", "genMultistateInput"]);
811
+ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ["manuSpecificSDevices"]);
812
+ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ["haDiagnostic"]);
813
+ device.save();
814
+ },
815
+ },
816
+ {
817
+ fingerprint: [{ modelID: "SBDV-00202", manufacturerName: "SDevices" }],
818
+ model: "SBDV-00202",
819
+ vendor: "Sber",
820
+ description: "Smart Wall Socket",
821
+ toZigbee: [sdevices.tz.custom_on_off, tz.power_on_behavior],
822
+ fromZigbee: [fz.on_off, fz.power_on_behavior, sdevices.fz.emergency_shutoff_state],
823
+ exposes: [
824
+ e.switch(),
825
+ e.power_on_behavior(["off", "on", "toggle", "previous"]),
826
+ e.binary("emergency_overvoltage", ea.STATE, true, false).withDescription("Overvoltage alarm is triggered").withCategory("diagnostic"),
827
+ e.binary("emergency_undervoltage", ea.STATE, true, false).withDescription("Undervoltage alarm is triggered").withCategory("diagnostic"),
828
+ e.binary("emergency_overcurrent", ea.STATE, true, false).withDescription("Overcurrent alarm is triggered").withCategory("diagnostic"),
829
+ e.binary("emergency_overheat", ea.STATE, true, false).withDescription("Overheat alarm is triggered").withCategory("diagnostic"),
830
+ ],
831
+ extend: [
832
+ sdevicesExtend.sdevicesCustomCluster(),
833
+ m.identify(),
834
+ sdevicesExtend.deviceTemperature(),
835
+ sdevicesExtend.childLock(),
836
+ sdevicesExtend.electricityMeter(),
837
+ sdevicesExtend.ledIndicatorSettings(),
838
+ sdevicesExtend.emergencyShutoffRecovery(),
839
+ sdevicesExtend.upperVoltageThreshold(),
840
+ sdevicesExtend.lowerVoltageThreshold(),
841
+ sdevicesExtend.upperCurrentThreshold(),
842
+ sdevicesExtend.temperatureThreshold(),
843
+ ],
844
+ ota: true,
845
+ configure: async (device, coordinatorEndpoint) => {
846
+ const endpoint = device.getEndpoint(1);
847
+ await endpoint.read("genBasic", ["serialNumber"]);
848
+ await endpoint.read("genOnOff", ["onOff", "startUpOnOff"]);
849
+ await endpoint.read("manuSpecificSDevices", ["childLock", "rmsVoltageMv", "rmsCurrentMa", "activePowerMw"]);
850
+ await endpoint.read("manuSpecificSDevices", [
851
+ "ledIndicatorOnEnable",
852
+ "ledIndicatorOnH",
853
+ "ledIndicatorOnS",
854
+ "ledIndicatorOnB",
855
+ "ledIndicatorOffEnable",
856
+ "ledIndicatorOffH",
857
+ "ledIndicatorOffS",
858
+ "ledIndicatorOffB",
859
+ ]);
860
+ await endpoint.read("manuSpecificSDevices", [
861
+ "upperVoltageThreshold",
862
+ "lowerVoltageThreshold",
863
+ "upperCurrentThreshold",
864
+ "upperTempThreshold",
865
+ ]);
866
+ await reporting.bind(endpoint, coordinatorEndpoint, ["genOnOff", "genDeviceTempCfg", "manuSpecificSDevices"]);
867
+ await reporting.bind(endpoint, coordinatorEndpoint, ["haDiagnostic"]);
868
+ },
869
+ },
97
870
  ];
98
871
  //# sourceMappingURL=sber.js.map