zigbee-herdsman-converters 14.0.533 → 14.0.534
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.
- package/devices/aubess.js +21 -0
- package/devices/third_reality.js +8 -0
- package/devices/tuya.js +1 -0
- package/lib/zosung.js +241 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const zosung = require('../lib/zosung');
|
|
2
|
+
const fzZosung = zosung.fzZosung;
|
|
3
|
+
const tzZosung = zosung.tzZosung;
|
|
4
|
+
const ez = zosung.presetsZosung;
|
|
5
|
+
|
|
6
|
+
module.exports = [
|
|
7
|
+
{
|
|
8
|
+
fingerprint: [{modelID: 'TS1201', manufacturerName: '_TZ3290_acv1iuslxi3shaaj'}],
|
|
9
|
+
model: 'ZXZIR-02',
|
|
10
|
+
vendor: 'AUBESS',
|
|
11
|
+
description: 'Universal smart IR remote control',
|
|
12
|
+
fromZigbee: [
|
|
13
|
+
fzZosung.zosung_send_ir_code_00, fzZosung.zosung_send_ir_code_01, fzZosung.zosung_send_ir_code_02,
|
|
14
|
+
fzZosung.zosung_send_ir_code_03, fzZosung.zosung_send_ir_code_04, fzZosung.zosung_send_ir_code_05,
|
|
15
|
+
],
|
|
16
|
+
toZigbee: [
|
|
17
|
+
tzZosung.zosung_ir_code_to_send, tzZosung.zosung_learn_ir_code,
|
|
18
|
+
],
|
|
19
|
+
exposes: [ez.learn_ir_code(), ez.learned_ir_code(), ez.ir_code_to_send()],
|
|
20
|
+
},
|
|
21
|
+
];
|
package/devices/third_reality.js
CHANGED
|
@@ -75,6 +75,10 @@ module.exports = [
|
|
|
75
75
|
toZigbee: [],
|
|
76
76
|
meta: {battery: {dontDividePercentage: true}},
|
|
77
77
|
exposes: [e.occupancy(), e.battery_low(), e.battery(), e.battery_voltage()],
|
|
78
|
+
configure: async (device, coordinatorEndpoint, logger) => {
|
|
79
|
+
device.powerSource = 'Battery';
|
|
80
|
+
device.save();
|
|
81
|
+
},
|
|
78
82
|
},
|
|
79
83
|
{
|
|
80
84
|
zigbeeModel: ['3RDS17BZ'],
|
|
@@ -85,6 +89,10 @@ module.exports = [
|
|
|
85
89
|
toZigbee: [],
|
|
86
90
|
meta: {battery: {dontDividePercentage: true}},
|
|
87
91
|
exposes: [e.contact(), e.battery_low(), e.battery(), e.battery_voltage()],
|
|
92
|
+
configure: async (device, coordinatorEndpoint, logger) => {
|
|
93
|
+
device.powerSource = 'Battery';
|
|
94
|
+
device.save();
|
|
95
|
+
},
|
|
88
96
|
},
|
|
89
97
|
{
|
|
90
98
|
zigbeeModel: ['3RSP019BZ'],
|
package/devices/tuya.js
CHANGED
|
@@ -223,6 +223,7 @@ module.exports = [
|
|
|
223
223
|
{
|
|
224
224
|
fingerprint: [{modelID: 'TS0001', manufacturerName: '_TZ3000_hktqahrq'}, {manufacturerName: '_TZ3000_hktqahrq'},
|
|
225
225
|
{manufacturerName: '_TZ3000_q6a3tepg'}, {modelID: 'TS000F', manufacturerName: '_TZ3000_m9af2l6g'},
|
|
226
|
+
{modelID: 'TS000F', manufacturerName: '_TZ3000_mx3vgyea'},
|
|
226
227
|
{modelID: 'TS0001', manufacturerName: '_TZ3000_npzfdcof'},
|
|
227
228
|
{modelID: 'TS0001', manufacturerName: '_TZ3000_5ng23zjs'},
|
|
228
229
|
{modelID: 'TS0001', manufacturerName: '_TZ3000_rmjr4ufz'},
|
package/lib/zosung.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const exposes = require('./exposes');
|
|
4
|
+
const ea = exposes.access;
|
|
5
|
+
|
|
6
|
+
function nextSeq(entity) {
|
|
7
|
+
entity.seq = ((entity.seq || -1)+1) % 0x10000;
|
|
8
|
+
return entity.seq;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function messagesGet(entity, seq) {
|
|
12
|
+
const info = entity.irMessageInfo;
|
|
13
|
+
if (info.seq!=seq) {
|
|
14
|
+
throw new Error(`Unexpected sequence value (expected: ${info.seq} current: ${seq}).`);
|
|
15
|
+
}
|
|
16
|
+
return info.data;
|
|
17
|
+
}
|
|
18
|
+
function messagesSet(entity, seq, data) {
|
|
19
|
+
entity.irMessageInfo={seq: seq, data: data};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function messagesClear(entity, seq) {
|
|
23
|
+
const info = entity.irMessageInfo;
|
|
24
|
+
if (info.seq!=seq) {
|
|
25
|
+
throw new Error(`Unexpected sequence value (expected: ${info.seq} current: ${seq}).`);
|
|
26
|
+
}
|
|
27
|
+
delete entity.irMessageInfo;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function calcArrayCrc(values) {
|
|
31
|
+
return Array.from(values.values()).reduce((a, b)=>a+b)%0x100;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function calcStringCrc(str) {
|
|
35
|
+
return str.split('').map((x)=>x.charCodeAt(0)).reduce((a, b)=>a+b)%0x100;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const fzZosung = {
|
|
40
|
+
zosung_send_ir_code_01: {
|
|
41
|
+
cluster: 'zosungIRTransmit',
|
|
42
|
+
type: ['commandZosungSendIRCode01'],
|
|
43
|
+
convert: (model, msg, publish, options, meta) => {
|
|
44
|
+
meta.logger.debug(`"IR-Message-Code01" received (msg:${JSON.stringify(msg.data)})`);
|
|
45
|
+
const seq = msg.data.seq;
|
|
46
|
+
const irMsg = messagesGet(msg.endpoint, seq);
|
|
47
|
+
meta.logger.debug(`IRCode to send: ${JSON.stringify(irMsg)} (seq:${seq})`);
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
zosung_send_ir_code_02: {
|
|
51
|
+
cluster: 'zosungIRTransmit',
|
|
52
|
+
type: ['commandZosungSendIRCode02'],
|
|
53
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
54
|
+
meta.logger.debug(`"IR-Message-Code02" received (msg:${JSON.stringify(msg.data)})`);
|
|
55
|
+
const seq = msg.data.seq;
|
|
56
|
+
const position = msg.data.position;
|
|
57
|
+
const irMsg = messagesGet(msg.endpoint, seq);
|
|
58
|
+
const part = irMsg.substring(position, position+0x32);
|
|
59
|
+
const sum = calcStringCrc(part);
|
|
60
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode03',
|
|
61
|
+
{
|
|
62
|
+
zero: 0,
|
|
63
|
+
seq: seq,
|
|
64
|
+
position: position,
|
|
65
|
+
msgpart: Buffer.from(part),
|
|
66
|
+
msgpartcrc: sum,
|
|
67
|
+
},
|
|
68
|
+
{disableDefaultResponse: true});
|
|
69
|
+
meta.logger.debug(`Sent IRCode part: ${part} (sum: ${sum}, seq:${seq})`);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
zosung_send_ir_code_04: {
|
|
73
|
+
cluster: 'zosungIRTransmit',
|
|
74
|
+
type: ['commandZosungSendIRCode04'],
|
|
75
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
76
|
+
meta.logger.debug(`"IR-Message-Code04" received (msg:${JSON.stringify(msg.data)})`);
|
|
77
|
+
const seq = msg.data.seq;
|
|
78
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode05',
|
|
79
|
+
{
|
|
80
|
+
seq: seq,
|
|
81
|
+
zero: 0,
|
|
82
|
+
},
|
|
83
|
+
{disableDefaultResponse: true});
|
|
84
|
+
messagesClear(msg.endpoint, seq);
|
|
85
|
+
meta.logger.debug(`IRCode has been successfuly sent. (seq:${seq})`);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
zosung_send_ir_code_00: {
|
|
89
|
+
cluster: 'zosungIRTransmit',
|
|
90
|
+
type: ['commandZosungSendIRCode00'],
|
|
91
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
92
|
+
meta.logger.debug(`"IR-Message-Code00" received (msg:${JSON.stringify(msg.data)})`);
|
|
93
|
+
const seq = msg.data.seq;
|
|
94
|
+
const length = msg.data.length;
|
|
95
|
+
messagesSet(msg.endpoint, seq, {position: 0, buf: Buffer.alloc(length)});
|
|
96
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode01',
|
|
97
|
+
{
|
|
98
|
+
zero: 0,
|
|
99
|
+
seq: seq,
|
|
100
|
+
length: length,
|
|
101
|
+
unk1: msg.data.unk1,
|
|
102
|
+
unk2: msg.data.unk2,
|
|
103
|
+
unk3: msg.data.unk3,
|
|
104
|
+
cmd: msg.data.cmd,
|
|
105
|
+
unk4: msg.data.unk4,
|
|
106
|
+
},
|
|
107
|
+
{disableDefaultResponse: true});
|
|
108
|
+
meta.logger.debug(`"IR-Message-Code00" response sent.`);
|
|
109
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode02',
|
|
110
|
+
{
|
|
111
|
+
seq: msg.data.seq,
|
|
112
|
+
position: 0,
|
|
113
|
+
maxlen: 0x38,
|
|
114
|
+
},
|
|
115
|
+
{disableDefaultResponse: true});
|
|
116
|
+
meta.logger.debug(`"IR-Message-Code00" transfer started.`);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
zosung_send_ir_code_03: {
|
|
120
|
+
cluster: 'zosungIRTransmit',
|
|
121
|
+
type: ['zosungSendIRCode03Resp'],
|
|
122
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
123
|
+
meta.logger.debug(`"IR-Message-Code03" received (msg:${JSON.stringify(msg.data)})`);
|
|
124
|
+
const seq = msg.data.seq;
|
|
125
|
+
const rcv = messagesGet(msg.endpoint, seq);
|
|
126
|
+
if (rcv.position==msg.data.position) {
|
|
127
|
+
const rcvMsgPart = msg.data.msgpart;
|
|
128
|
+
const sum = calcArrayCrc(rcvMsgPart);
|
|
129
|
+
const expectedPartCrc = msg.data.msgpartcrc;
|
|
130
|
+
if (sum==expectedPartCrc) {
|
|
131
|
+
const position = rcvMsgPart.copy(rcv.buf, rcv.position);
|
|
132
|
+
rcv.position += position;
|
|
133
|
+
if (rcv.position<rcv.buf.length) {
|
|
134
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode02',
|
|
135
|
+
{
|
|
136
|
+
seq: seq,
|
|
137
|
+
position: rcv.position,
|
|
138
|
+
maxlen: 0x38,
|
|
139
|
+
},
|
|
140
|
+
{disableDefaultResponse: true});
|
|
141
|
+
} else {
|
|
142
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode04',
|
|
143
|
+
{
|
|
144
|
+
zero0: 0,
|
|
145
|
+
seq: seq,
|
|
146
|
+
zero1: 0,
|
|
147
|
+
},
|
|
148
|
+
{disableDefaultResponse: true});
|
|
149
|
+
}
|
|
150
|
+
meta.logger.debug(`${rcvMsgPart.length} bytes received.`);
|
|
151
|
+
} else {
|
|
152
|
+
meta.logger.error(`Invalid msg part CRC: ${sum} expecting: ${expectedPartCrc}.`);
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
meta.logger.error(`Unexpected IR code position: ${JSON.stringify(msg.data)}, expecting: ${rcv.position}.`);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
zosung_send_ir_code_05: {
|
|
160
|
+
cluster: 'zosungIRTransmit',
|
|
161
|
+
type: ['zosungSendIRCode05Resp'],
|
|
162
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
163
|
+
meta.logger.debug(`"IR-Message-Code05" received (msg:${JSON.stringify(msg.data)})`);
|
|
164
|
+
const seq = msg.data.seq;
|
|
165
|
+
const rcv = messagesGet(msg.endpoint, seq);
|
|
166
|
+
const learnedIRCode = rcv.buf.toString('base64');
|
|
167
|
+
meta.logger.debug(`Received: ${learnedIRCode}`);
|
|
168
|
+
messagesClear(msg.endpoint, seq);
|
|
169
|
+
await msg.endpoint.command('zosungIRControl', 'zosungControlIRCommand00',
|
|
170
|
+
{
|
|
171
|
+
data: Buffer.from(JSON.stringify({'study': 1})),
|
|
172
|
+
},
|
|
173
|
+
{disableDefaultResponse: true});
|
|
174
|
+
return {
|
|
175
|
+
learned_ir_code: learnedIRCode,
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const tzZosung = {
|
|
182
|
+
zosung_ir_code_to_send: {
|
|
183
|
+
key: ['ir_code_to_send'],
|
|
184
|
+
convertSet: async (entity, key, value, meta) => {
|
|
185
|
+
if (!value) {
|
|
186
|
+
meta.logger.error(`There is no IR code to send`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const irMsg = JSON.stringify({
|
|
190
|
+
'key_num': 1,
|
|
191
|
+
'delay': 300,
|
|
192
|
+
'key1': {
|
|
193
|
+
'num': 1,
|
|
194
|
+
'freq': 38000,
|
|
195
|
+
'type': 1,
|
|
196
|
+
'key_code': value,
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
meta.logger.debug(`Sending IR code: ${JSON.stringify(value)}`);
|
|
200
|
+
const seq = nextSeq(entity);
|
|
201
|
+
messagesSet(entity, seq, irMsg);
|
|
202
|
+
await entity.command('zosungIRTransmit', 'zosungSendIRCode00',
|
|
203
|
+
{
|
|
204
|
+
seq: seq,
|
|
205
|
+
length: irMsg.length,
|
|
206
|
+
unk1: 0x00000000,
|
|
207
|
+
unk2: 0xe004,
|
|
208
|
+
unk3: 0x01,
|
|
209
|
+
cmd: 0x02,
|
|
210
|
+
unk4: 0x0000,
|
|
211
|
+
},
|
|
212
|
+
{disableDefaultResponse: true});
|
|
213
|
+
meta.logger.debug(`Sending IR code initiated.`);
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
zosung_learn_ir_code: {
|
|
217
|
+
key: ['learn_ir_code'],
|
|
218
|
+
convertSet: async (entity, key, value, meta) => {
|
|
219
|
+
meta.logger.debug(`Starting IR Code Learning...`);
|
|
220
|
+
await entity.command('zosungIRControl', 'zosungControlIRCommand00',
|
|
221
|
+
{
|
|
222
|
+
data: Buffer.from(JSON.stringify({'study': 0})),
|
|
223
|
+
},
|
|
224
|
+
{disableDefaultResponse: true});
|
|
225
|
+
meta.logger.debug(`IR Code Learning started.`);
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
const presetsZosung = {
|
|
232
|
+
learn_ir_code: () => exposes.switch().withState('learn_ir_code', false, 'Turn on to learn new IR code', ea.SET),
|
|
233
|
+
learned_ir_code: () => exposes.text('learned_ir_code', ea.STATE).withDescription('The IR code learned by device'),
|
|
234
|
+
ir_code_to_send: () => exposes.text('ir_code_to_send', ea.SET).withDescription('The IR code to send by device'),
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
module.exports = {
|
|
238
|
+
fzZosung,
|
|
239
|
+
tzZosung,
|
|
240
|
+
presetsZosung,
|
|
241
|
+
};
|