forked from Koenkk/zigbee-herdsman-converters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ewelink.js
95 lines (94 loc) · 3.82 KB
/
ewelink.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const exposes = require('../lib/exposes');
const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/legacy').fromZigbee};
const reporting = require('../lib/reporting');
const extend = require('../lib/extend');
const e = exposes.presets;
module.exports = [
{
zigbeeModel: ['SA-003-Zigbee'],
model: 'SA-003-Zigbee',
vendor: 'eWeLink',
description: 'Zigbee smart plug',
extend: extend.switch(),
fromZigbee: [fz.on_off_skip_duplicate_transaction],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
},
onEvent: async (type, data, device) => {
device.skipDefaultResponse = true;
},
},
{
zigbeeModel: ['ZB-SW01'],
model: 'ZB-SW01',
vendor: 'eWeLink',
description: 'Smart light switch - 1 gang',
extend: extend.switch(),
fromZigbee: [fz.on_off_skip_duplicate_transaction],
onEvent: async (type, data, device) => {
device.skipDefaultResponse = true;
},
},
{
zigbeeModel: ['ZB-SW02', 'E220-KR2N0Z0-HA'],
model: 'ZB-SW02',
vendor: 'eWeLink',
description: 'Smart light switch - 2 gang',
extend: extend.switch(),
exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right')],
endpoint: (device) => {
return {'left': 1, 'right': 2};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
},
onEvent: async (type, data, device) => {
device.skipDefaultResponse = true;
},
},
{
zigbeeModel: ['ZB-SW03'],
model: 'ZB-SW03',
vendor: 'eWeLink',
description: 'Smart light switch - 3 gang',
extend: extend.switch(),
exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('center'), e.switch().withEndpoint('right')],
endpoint: (device) => {
return {'left': 1, 'center': 2, 'right': 3};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']);
},
onEvent: async (type, data, device) => {
device.skipDefaultResponse = true;
},
},
{
zigbeeModel: ['ZB-SW04'],
model: 'ZB-SW04',
vendor: 'eWeLink',
description: 'Smart light switch - 4 gang',
extend: extend.switch(),
exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'),
e.switch().withEndpoint('l3'), e.switch().withEndpoint('l4')],
endpoint: (device) => {
return {'l1': 1, 'l2': 2, 'l3': 3, 'l4': 4};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']);
await reporting.bind(device.getEndpoint(4), coordinatorEndpoint, ['genOnOff']);
},
onEvent: async (type, data, device) => {
device.skipDefaultResponse = true;
},
},
];