@willieee802/zigbee-herdsman-converters 15.0.8-4.1
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/LICENSE +21 -0
- package/README.md +7 -0
- package/converters/fromZigbee.js +8439 -0
- package/converters/toZigbee.js +7162 -0
- package/devices/ITCommander.js +37 -0
- package/devices/RMC002.js +20 -0
- package/devices/acova.js +101 -0
- package/devices/acuity_brands_lighting.js +11 -0
- package/devices/adeo.js +256 -0
- package/devices/adurosmart.js +130 -0
- package/devices/aeotec.js +13 -0
- package/devices/airam.js +59 -0
- package/devices/ajax_online.js +49 -0
- package/devices/akuvox.js +28 -0
- package/devices/alchemy.js +18 -0
- package/devices/aldi.js +53 -0
- package/devices/alecto.js +98 -0
- package/devices/anchor.js +17 -0
- package/devices/atlantic.js +110 -0
- package/devices/atsmart.js +28 -0
- package/devices/aubess.js +21 -0
- package/devices/aurora_lighting.js +292 -0
- package/devices/automaton.js +44 -0
- package/devices/awox.js +184 -0
- package/devices/axis.js +22 -0
- package/devices/bankamp.js +11 -0
- package/devices/bega.js +22 -0
- package/devices/belkin.js +11 -0
- package/devices/bitron.js +334 -0
- package/devices/blaupunkt.js +27 -0
- package/devices/blitzwolf.js +47 -0
- package/devices/bosch.js +702 -0
- package/devices/brimate.js +15 -0
- package/devices/bseed.js +17 -0
- package/devices/bticino.js +118 -0
- package/devices/busch-jaeger.js +140 -0
- package/devices/byun.js +24 -0
- package/devices/calex.js +37 -0
- package/devices/candeo.js +49 -0
- package/devices/casaia.js +52 -0
- package/devices/centralite.js +359 -0
- package/devices/cleode.js +20 -0
- package/devices/cleverio.js +36 -0
- package/devices/climax.js +138 -0
- package/devices/commercial_electric.js +16 -0
- package/devices/connecte.js +46 -0
- package/devices/cree.js +11 -0
- package/devices/ctm.js +999 -0
- package/devices/current_products_corp.js +24 -0
- package/devices/custom_devices_diy.js +850 -0
- package/devices/cy-lighting.js +11 -0
- package/devices/danalock.js +26 -0
- package/devices/danfoss.js +340 -0
- package/devices/databyte.ch.js +55 -0
- package/devices/datek.js +246 -0
- package/devices/dawon_dns.js +338 -0
- package/devices/develco.js +868 -0
- package/devices/digi.js +14 -0
- package/devices/diyruz.js +305 -0
- package/devices/dlink.js +37 -0
- package/devices/dnake.js +11 -0
- package/devices/dresden_elektronik.js +47 -0
- package/devices/easyaccess.js +27 -0
- package/devices/eatonhalo_led.js +11 -0
- package/devices/echostar.js +25 -0
- package/devices/ecodim.js +145 -0
- package/devices/ecolink.js +21 -0
- package/devices/ecosmart.js +64 -0
- package/devices/ecozy.js +31 -0
- package/devices/edp.js +39 -0
- package/devices/eglo.js +25 -0
- package/devices/elko.js +176 -0
- package/devices/enbrighten.js +163 -0
- package/devices/enocean.js +52 -0
- package/devices/envilar.js +73 -0
- package/devices/essentialb.js +87 -0
- package/devices/eurotronic.js +48 -0
- package/devices/evanell.js +29 -0
- package/devices/evn.js +31 -0
- package/devices/evology.js +24 -0
- package/devices/evvr.js +17 -0
- package/devices/ewelink.js +184 -0
- package/devices/ezex.js +24 -0
- package/devices/fantem.js +77 -0
- package/devices/feibit.js +172 -0
- package/devices/fireangel.js +15 -0
- package/devices/frankever.js +23 -0
- package/devices/garza.js +11 -0
- package/devices/ge.js +111 -0
- package/devices/gewiss.js +48 -0
- package/devices/gidealed.js +11 -0
- package/devices/giderwel.js +11 -0
- package/devices/giex.js +222 -0
- package/devices/girier.js +19 -0
- package/devices/gledopto.js +756 -0
- package/devices/gmy.js +11 -0
- package/devices/gs.js +29 -0
- package/devices/halemeier.js +18 -0
- package/devices/hampton_bay.js +37 -0
- package/devices/heiman.js +805 -0
- package/devices/hej.js +107 -0
- package/devices/hfh.js +11 -0
- package/devices/hgkg.js +54 -0
- package/devices/hilux.js +11 -0
- package/devices/hive.js +524 -0
- package/devices/home_control_as.js +27 -0
- package/devices/hommyn.js +24 -0
- package/devices/honyar.js +29 -0
- package/devices/hornbach.js +53 -0
- package/devices/hzc.js +21 -0
- package/devices/hzc_electric.js +42 -0
- package/devices/icasa.js +121 -0
- package/devices/idinio.js +19 -0
- package/devices/ihorn.js +61 -0
- package/devices/ikea.js +1168 -0
- package/devices/ilightsin.js +11 -0
- package/devices/iluminize.js +262 -0
- package/devices/ilux.js +11 -0
- package/devices/immax.js +203 -0
- package/devices/innr.js +705 -0
- package/devices/inovelli.js +1315 -0
- package/devices/insta.js +110 -0
- package/devices/iolloi.js +20 -0
- package/devices/iotperfect.js +20 -0
- package/devices/iris.js +180 -0
- package/devices/istar.js +20 -0
- package/devices/jasco.js +55 -0
- package/devices/javis.js +37 -0
- package/devices/jethome.js +48 -0
- package/devices/jiawen.js +18 -0
- package/devices/jumitech.js +18 -0
- package/devices/jxuan.js +49 -0
- package/devices/kami.js +15 -0
- package/devices/keen_home.js +80 -0
- package/devices/klikaanklikuit.js +17 -0
- package/devices/kmpcil.js +148 -0
- package/devices/konke.js +141 -0
- package/devices/ksentry.js +17 -0
- package/devices/kurvia.js +17 -0
- package/devices/kwikset.js +120 -0
- package/devices/lanesto.js +11 -0
- package/devices/lds.js +11 -0
- package/devices/led_trading.js +69 -0
- package/devices/ledvance.js +353 -0
- package/devices/leedarson.js +130 -0
- package/devices/legrand.js +554 -0
- package/devices/lellki.js +146 -0
- package/devices/letsled.js +11 -0
- package/devices/letv.js +18 -0
- package/devices/leviton.js +142 -0
- package/devices/lg.js +18 -0
- package/devices/lidl.js +1000 -0
- package/devices/lifecontrol.js +92 -0
- package/devices/lightsolutions.js +37 -0
- package/devices/linkind.js +205 -0
- package/devices/livingwise.js +59 -0
- package/devices/livolo.js +286 -0
- package/devices/lixee.js +779 -0
- package/devices/lonsonho.js +218 -0
- package/devices/lubeez.js +18 -0
- package/devices/lupus.js +74 -0
- package/devices/lutron.js +32 -0
- package/devices/lux.js +40 -0
- package/devices/m-elec.js +18 -0
- package/devices/makegood.js +51 -0
- package/devices/matcall_bv.js +18 -0
- package/devices/meazon.js +47 -0
- package/devices/mercator.js +225 -0
- package/devices/miboxer.js +72 -0
- package/devices/micromatic.js +29 -0
- package/devices/moes.js +400 -0
- package/devices/mycket.js +11 -0
- package/devices/m/303/274ller_licht.js +220 -0
- package/devices/namron.js +774 -0
- package/devices/nanoleaf.js +11 -0
- package/devices/neo.js +86 -0
- package/devices/net2grid.js +29 -0
- package/devices/netvox.js +35 -0
- package/devices/niko.js +314 -0
- package/devices/ninja_blocks.js +24 -0
- package/devices/niviss.js +11 -0
- package/devices/nodon.js +109 -0
- package/devices/nordtronic.js +30 -0
- package/devices/nous.js +88 -0
- package/devices/novo.js +17 -0
- package/devices/nue_3a.js +417 -0
- package/devices/nyce.js +67 -0
- package/devices/onesti.js +59 -0
- package/devices/openlumi.js +22 -0
- package/devices/orvibo.js +515 -0
- package/devices/osram.js +519 -0
- package/devices/oujiabao.js +15 -0
- package/devices/owon.js +352 -0
- package/devices/ozsmartthings.js +11 -0
- package/devices/paul_neuhaus.js +96 -0
- package/devices/paulmann.js +158 -0
- package/devices/peq.js +24 -0
- package/devices/perenio.js +413 -0
- package/devices/philips.js +3118 -0
- package/devices/plaid.js +25 -0
- package/devices/plugwise.js +173 -0
- package/devices/popp.js +10 -0
- package/devices/profalux.js +47 -0
- package/devices/prolight.js +54 -0
- package/devices/qmotion.js +33 -0
- package/devices/qoto.js +113 -0
- package/devices/quotra.js +18 -0
- package/devices/rademacher.js +18 -0
- package/devices/rgb_genie.js +119 -0
- package/devices/robb.js +335 -0
- package/devices/roome.js +15 -0
- package/devices/rtx.js +90 -0
- package/devices/salus_controls.js +137 -0
- package/devices/samotech.js +93 -0
- package/devices/saswell.js +58 -0
- package/devices/scanproducts.js +32 -0
- package/devices/schlage.js +24 -0
- package/devices/schneider_electric.js +1039 -0
- package/devices/schwaiger.js +62 -0
- package/devices/seastar_intelligence.js +16 -0
- package/devices/securifi.js +39 -0
- package/devices/sengled.js +332 -0
- package/devices/sercomm.js +140 -0
- package/devices/shenzhen_homa.js +53 -0
- package/devices/shinasystem.js +686 -0
- package/devices/siglis.js +440 -0
- package/devices/sinope.js +1257 -0
- package/devices/siterwell.js +46 -0
- package/devices/skydance.js +112 -0
- package/devices/slv.js +27 -0
- package/devices/smart9.js +27 -0
- package/devices/smart_home_pty.js +18 -0
- package/devices/smartenit.js +42 -0
- package/devices/smartthings.js +495 -0
- package/devices/smartwings.js +24 -0
- package/devices/sohan_electric.js +13 -0
- package/devices/solaredge.js +11 -0
- package/devices/somgoms.js +47 -0
- package/devices/sonoff.js +262 -0
- package/devices/spotmau.js +36 -0
- package/devices/sprut.js +317 -0
- package/devices/stelpro.js +216 -0
- package/devices/sunricher.js +625 -0
- package/devices/swann.js +33 -0
- package/devices/sylvania.js +200 -0
- package/devices/tci.js +25 -0
- package/devices/technicolor.js +47 -0
- package/devices/terncy.js +64 -0
- package/devices/the_light_group.js +70 -0
- package/devices/third_reality.js +195 -0
- package/devices/titan_products.js +22 -0
- package/devices/tplink.js +42 -0
- package/devices/trust.js +114 -0
- package/devices/tubeszb.js +20 -0
- package/devices/tuya.js +4215 -0
- package/devices/ubisys.js +938 -0
- package/devices/uhome.js +25 -0
- package/devices/universal_electronics_inc.js +119 -0
- package/devices/urlighting.js +12 -0
- package/devices/useelink.js +52 -0
- package/devices/vbled.js +18 -0
- package/devices/vesternet.js +188 -0
- package/devices/viessmann.js +51 -0
- package/devices/villeroy_boch.js +18 -0
- package/devices/vimar.js +78 -0
- package/devices/visonic.js +80 -0
- package/devices/vrey.js +18 -0
- package/devices/wally.js +25 -0
- package/devices/waxman.js +45 -0
- package/devices/weiser.js +67 -0
- package/devices/weten.js +13 -0
- package/devices/wisdom.js +11 -0
- package/devices/woox.js +177 -0
- package/devices/wyze.js +23 -0
- package/devices/xiaomi.js +3223 -0
- package/devices/xinghuoyuan.js +11 -0
- package/devices/yale.js +227 -0
- package/devices/ynoa.js +68 -0
- package/devices/yookee.js +23 -0
- package/devices/ysrsai.js +26 -0
- package/devices/zemismart.js +254 -0
- package/devices/zen.js +34 -0
- package/devices/zipato.js +11 -0
- package/index.js +242 -0
- package/lib/color.js +784 -0
- package/lib/configureKey.js +944 -0
- package/lib/constants.js +316 -0
- package/lib/exposes.js +677 -0
- package/lib/extend.js +180 -0
- package/lib/kelvinToXy.js +1912 -0
- package/lib/legacy.js +2223 -0
- package/lib/light.js +111 -0
- package/lib/ota/OTA_URLs.md +119 -0
- package/lib/ota/common.js +476 -0
- package/lib/ota/index.js +10 -0
- package/lib/ota/inovelli.js +72 -0
- package/lib/ota/ledvance.js +52 -0
- package/lib/ota/lixee.js +57 -0
- package/lib/ota/salus.js +82 -0
- package/lib/ota/securifi.js +25 -0
- package/lib/ota/tradfri.js +45 -0
- package/lib/ota/ubisys.js +61 -0
- package/lib/ota/zigbeeOTA.js +161 -0
- package/lib/philips.js +667 -0
- package/lib/reporting.js +234 -0
- package/lib/store.js +57 -0
- package/lib/tuya.js +2027 -0
- package/lib/utils.js +527 -0
- package/lib/xiaomi.d.ts +11 -0
- package/lib/xiaomi.js +1288 -0
- package/lib/zosung.js +243 -0
- package/package.json +39 -0
package/lib/zosung.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
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
|
+
const expected = (info&&info.seq) || 0;
|
|
14
|
+
if (expected!==seq) {
|
|
15
|
+
throw new Error(`Unexpected sequence value (expected: ${expected} current: ${seq}).`);
|
|
16
|
+
}
|
|
17
|
+
return info.data;
|
|
18
|
+
}
|
|
19
|
+
function messagesSet(entity, seq, data) {
|
|
20
|
+
entity.irMessageInfo={seq: seq, data: data};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function messagesClear(entity, seq) {
|
|
24
|
+
const info = entity.irMessageInfo;
|
|
25
|
+
const expected = (info&&info.seq) || 0;
|
|
26
|
+
if (expected!==seq) {
|
|
27
|
+
throw new Error(`Unexpected sequence value (expected: ${expected} current: ${seq}).`);
|
|
28
|
+
}
|
|
29
|
+
delete entity.irMessageInfo;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function calcArrayCrc(values) {
|
|
33
|
+
return Array.from(values.values()).reduce((a, b)=>a+b, 0)%0x100;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function calcStringCrc(str) {
|
|
37
|
+
return str.split('').map((x)=>x.charCodeAt(0)).reduce((a, b)=>a+b, 0)%0x100;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const fzZosung = {
|
|
42
|
+
zosung_send_ir_code_01: {
|
|
43
|
+
cluster: 'zosungIRTransmit',
|
|
44
|
+
type: ['commandZosungSendIRCode01'],
|
|
45
|
+
convert: (model, msg, publish, options, meta) => {
|
|
46
|
+
meta.logger.debug(`"IR-Message-Code01" received (msg:${JSON.stringify(msg.data)})`);
|
|
47
|
+
const seq = msg.data.seq;
|
|
48
|
+
const irMsg = messagesGet(msg.endpoint, seq);
|
|
49
|
+
meta.logger.debug(`IRCode to send: ${JSON.stringify(irMsg)} (seq:${seq})`);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
zosung_send_ir_code_02: {
|
|
53
|
+
cluster: 'zosungIRTransmit',
|
|
54
|
+
type: ['commandZosungSendIRCode02'],
|
|
55
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
56
|
+
meta.logger.debug(`"IR-Message-Code02" received (msg:${JSON.stringify(msg.data)})`);
|
|
57
|
+
const seq = msg.data.seq;
|
|
58
|
+
const position = msg.data.position;
|
|
59
|
+
const irMsg = messagesGet(msg.endpoint, seq);
|
|
60
|
+
const part = irMsg.substring(position, position+0x32);
|
|
61
|
+
const sum = calcStringCrc(part);
|
|
62
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode03',
|
|
63
|
+
{
|
|
64
|
+
zero: 0,
|
|
65
|
+
seq: seq,
|
|
66
|
+
position: position,
|
|
67
|
+
msgpart: Buffer.from(part),
|
|
68
|
+
msgpartcrc: sum,
|
|
69
|
+
},
|
|
70
|
+
{disableDefaultResponse: true});
|
|
71
|
+
meta.logger.debug(`Sent IRCode part: ${part} (sum: ${sum}, seq:${seq})`);
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
zosung_send_ir_code_04: {
|
|
75
|
+
cluster: 'zosungIRTransmit',
|
|
76
|
+
type: ['commandZosungSendIRCode04'],
|
|
77
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
78
|
+
meta.logger.debug(`"IR-Message-Code04" received (msg:${JSON.stringify(msg.data)})`);
|
|
79
|
+
const seq = msg.data.seq;
|
|
80
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode05',
|
|
81
|
+
{
|
|
82
|
+
seq: seq,
|
|
83
|
+
zero: 0,
|
|
84
|
+
},
|
|
85
|
+
{disableDefaultResponse: true});
|
|
86
|
+
messagesClear(msg.endpoint, seq);
|
|
87
|
+
meta.logger.debug(`IRCode has been successfuly sent. (seq:${seq})`);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
zosung_send_ir_code_00: {
|
|
91
|
+
cluster: 'zosungIRTransmit',
|
|
92
|
+
type: ['commandZosungSendIRCode00'],
|
|
93
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
94
|
+
meta.logger.debug(`"IR-Message-Code00" received (msg:${JSON.stringify(msg.data)})`);
|
|
95
|
+
const seq = msg.data.seq;
|
|
96
|
+
const length = msg.data.length;
|
|
97
|
+
messagesSet(msg.endpoint, seq, {position: 0, buf: Buffer.alloc(length)});
|
|
98
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode01',
|
|
99
|
+
{
|
|
100
|
+
zero: 0,
|
|
101
|
+
seq: seq,
|
|
102
|
+
length: length,
|
|
103
|
+
unk1: msg.data.unk1,
|
|
104
|
+
unk2: msg.data.unk2,
|
|
105
|
+
unk3: msg.data.unk3,
|
|
106
|
+
cmd: msg.data.cmd,
|
|
107
|
+
unk4: msg.data.unk4,
|
|
108
|
+
},
|
|
109
|
+
{disableDefaultResponse: true});
|
|
110
|
+
meta.logger.debug(`"IR-Message-Code00" response sent.`);
|
|
111
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode02',
|
|
112
|
+
{
|
|
113
|
+
seq: msg.data.seq,
|
|
114
|
+
position: 0,
|
|
115
|
+
maxlen: 0x38,
|
|
116
|
+
},
|
|
117
|
+
{disableDefaultResponse: true});
|
|
118
|
+
meta.logger.debug(`"IR-Message-Code00" transfer started.`);
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
zosung_send_ir_code_03: {
|
|
122
|
+
cluster: 'zosungIRTransmit',
|
|
123
|
+
type: ['zosungSendIRCode03Resp'],
|
|
124
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
125
|
+
meta.logger.debug(`"IR-Message-Code03" received (msg:${JSON.stringify(msg.data)})`);
|
|
126
|
+
const seq = msg.data.seq;
|
|
127
|
+
const rcv = messagesGet(msg.endpoint, seq);
|
|
128
|
+
if (rcv.position==msg.data.position) {
|
|
129
|
+
const rcvMsgPart = msg.data.msgpart;
|
|
130
|
+
const sum = calcArrayCrc(rcvMsgPart);
|
|
131
|
+
const expectedPartCrc = msg.data.msgpartcrc;
|
|
132
|
+
if (sum==expectedPartCrc) {
|
|
133
|
+
const position = rcvMsgPart.copy(rcv.buf, rcv.position);
|
|
134
|
+
rcv.position += position;
|
|
135
|
+
if (rcv.position<rcv.buf.length) {
|
|
136
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode02',
|
|
137
|
+
{
|
|
138
|
+
seq: seq,
|
|
139
|
+
position: rcv.position,
|
|
140
|
+
maxlen: 0x38,
|
|
141
|
+
},
|
|
142
|
+
{disableDefaultResponse: true});
|
|
143
|
+
} else {
|
|
144
|
+
await msg.endpoint.command('zosungIRTransmit', 'zosungSendIRCode04',
|
|
145
|
+
{
|
|
146
|
+
zero0: 0,
|
|
147
|
+
seq: seq,
|
|
148
|
+
zero1: 0,
|
|
149
|
+
},
|
|
150
|
+
{disableDefaultResponse: true});
|
|
151
|
+
}
|
|
152
|
+
meta.logger.debug(`${rcvMsgPart.length} bytes received.`);
|
|
153
|
+
} else {
|
|
154
|
+
meta.logger.error(`Invalid msg part CRC: ${sum} expecting: ${expectedPartCrc}.`);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
meta.logger.error(`Unexpected IR code position: ${JSON.stringify(msg.data)}, expecting: ${rcv.position}.`);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
zosung_send_ir_code_05: {
|
|
162
|
+
cluster: 'zosungIRTransmit',
|
|
163
|
+
type: ['zosungSendIRCode05Resp'],
|
|
164
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
165
|
+
meta.logger.debug(`"IR-Message-Code05" received (msg:${JSON.stringify(msg.data)})`);
|
|
166
|
+
const seq = msg.data.seq;
|
|
167
|
+
const rcv = messagesGet(msg.endpoint, seq);
|
|
168
|
+
const learnedIRCode = rcv.buf.toString('base64');
|
|
169
|
+
meta.logger.debug(`Received: ${learnedIRCode}`);
|
|
170
|
+
messagesClear(msg.endpoint, seq);
|
|
171
|
+
await msg.endpoint.command('zosungIRControl', 'zosungControlIRCommand00',
|
|
172
|
+
{
|
|
173
|
+
data: Buffer.from(JSON.stringify({'study': 1})),
|
|
174
|
+
},
|
|
175
|
+
{disableDefaultResponse: true});
|
|
176
|
+
return {
|
|
177
|
+
learned_ir_code: learnedIRCode,
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const tzZosung = {
|
|
184
|
+
zosung_ir_code_to_send: {
|
|
185
|
+
key: ['ir_code_to_send'],
|
|
186
|
+
convertSet: async (entity, key, value, meta) => {
|
|
187
|
+
if (!value) {
|
|
188
|
+
meta.logger.error(`There is no IR code to send`);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const irMsg = JSON.stringify({
|
|
192
|
+
'key_num': 1,
|
|
193
|
+
'delay': 300,
|
|
194
|
+
'key1': {
|
|
195
|
+
'num': 1,
|
|
196
|
+
'freq': 38000,
|
|
197
|
+
'type': 1,
|
|
198
|
+
'key_code': value,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
meta.logger.debug(`Sending IR code: ${JSON.stringify(value)}`);
|
|
202
|
+
const seq = nextSeq(entity);
|
|
203
|
+
messagesSet(entity, seq, irMsg);
|
|
204
|
+
await entity.command('zosungIRTransmit', 'zosungSendIRCode00',
|
|
205
|
+
{
|
|
206
|
+
seq: seq,
|
|
207
|
+
length: irMsg.length,
|
|
208
|
+
unk1: 0x00000000,
|
|
209
|
+
unk2: 0xe004,
|
|
210
|
+
unk3: 0x01,
|
|
211
|
+
cmd: 0x02,
|
|
212
|
+
unk4: 0x0000,
|
|
213
|
+
},
|
|
214
|
+
{disableDefaultResponse: true});
|
|
215
|
+
meta.logger.debug(`Sending IR code initiated.`);
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
zosung_learn_ir_code: {
|
|
219
|
+
key: ['learn_ir_code'],
|
|
220
|
+
convertSet: async (entity, key, value, meta) => {
|
|
221
|
+
meta.logger.debug(`Starting IR Code Learning...`);
|
|
222
|
+
await entity.command('zosungIRControl', 'zosungControlIRCommand00',
|
|
223
|
+
{
|
|
224
|
+
data: Buffer.from(JSON.stringify({'study': 0})),
|
|
225
|
+
},
|
|
226
|
+
{disableDefaultResponse: true});
|
|
227
|
+
meta.logger.debug(`IR Code Learning started.`);
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
const presetsZosung = {
|
|
234
|
+
learn_ir_code: () => exposes.switch().withState('learn_ir_code', false, 'Turn on to learn new IR code', ea.SET),
|
|
235
|
+
learned_ir_code: () => exposes.text('learned_ir_code', ea.STATE).withDescription('The IR code learned by device'),
|
|
236
|
+
ir_code_to_send: () => exposes.text('ir_code_to_send', ea.SET).withDescription('The IR code to send by device'),
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
module.exports = {
|
|
240
|
+
fzZosung,
|
|
241
|
+
tzZosung,
|
|
242
|
+
presetsZosung,
|
|
243
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@willieee802/zigbee-herdsman-converters",
|
|
3
|
+
"version": "15.0.84.1",
|
|
4
|
+
"description": "Custom fork from zigbee-herdsman-converters",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"/index.js",
|
|
8
|
+
"/converters",
|
|
9
|
+
"/devices.js",
|
|
10
|
+
"/devices",
|
|
11
|
+
"/lib"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git://github.com/willieee802/zigbee-herdsman-converters.git"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"lint": "eslint .",
|
|
19
|
+
"test": "ZHC_TEST=true jest test",
|
|
20
|
+
"test-watch": "ZHC_TEST=true jest test --watch"
|
|
21
|
+
},
|
|
22
|
+
"author": "willieee802",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"homepage": "https://github.com/Koenkk/zigbee-herdsman-converters",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"axios": "^1.3.4",
|
|
27
|
+
"buffer-crc32": "^0.2.13",
|
|
28
|
+
"https-proxy-agent": "^5.0.1",
|
|
29
|
+
"tar-stream": "^3.0.0",
|
|
30
|
+
"@willieee802/zigbee-herdsman": "*"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"eslint": "*",
|
|
34
|
+
"eslint-config-google": "*",
|
|
35
|
+
"eslint-plugin-jest": "*",
|
|
36
|
+
"fast-deep-equal": "*",
|
|
37
|
+
"jest": "*"
|
|
38
|
+
}
|
|
39
|
+
}
|