@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.
Files changed (312) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/converters/fromZigbee.js +8439 -0
  4. package/converters/toZigbee.js +7162 -0
  5. package/devices/ITCommander.js +37 -0
  6. package/devices/RMC002.js +20 -0
  7. package/devices/acova.js +101 -0
  8. package/devices/acuity_brands_lighting.js +11 -0
  9. package/devices/adeo.js +256 -0
  10. package/devices/adurosmart.js +130 -0
  11. package/devices/aeotec.js +13 -0
  12. package/devices/airam.js +59 -0
  13. package/devices/ajax_online.js +49 -0
  14. package/devices/akuvox.js +28 -0
  15. package/devices/alchemy.js +18 -0
  16. package/devices/aldi.js +53 -0
  17. package/devices/alecto.js +98 -0
  18. package/devices/anchor.js +17 -0
  19. package/devices/atlantic.js +110 -0
  20. package/devices/atsmart.js +28 -0
  21. package/devices/aubess.js +21 -0
  22. package/devices/aurora_lighting.js +292 -0
  23. package/devices/automaton.js +44 -0
  24. package/devices/awox.js +184 -0
  25. package/devices/axis.js +22 -0
  26. package/devices/bankamp.js +11 -0
  27. package/devices/bega.js +22 -0
  28. package/devices/belkin.js +11 -0
  29. package/devices/bitron.js +334 -0
  30. package/devices/blaupunkt.js +27 -0
  31. package/devices/blitzwolf.js +47 -0
  32. package/devices/bosch.js +702 -0
  33. package/devices/brimate.js +15 -0
  34. package/devices/bseed.js +17 -0
  35. package/devices/bticino.js +118 -0
  36. package/devices/busch-jaeger.js +140 -0
  37. package/devices/byun.js +24 -0
  38. package/devices/calex.js +37 -0
  39. package/devices/candeo.js +49 -0
  40. package/devices/casaia.js +52 -0
  41. package/devices/centralite.js +359 -0
  42. package/devices/cleode.js +20 -0
  43. package/devices/cleverio.js +36 -0
  44. package/devices/climax.js +138 -0
  45. package/devices/commercial_electric.js +16 -0
  46. package/devices/connecte.js +46 -0
  47. package/devices/cree.js +11 -0
  48. package/devices/ctm.js +999 -0
  49. package/devices/current_products_corp.js +24 -0
  50. package/devices/custom_devices_diy.js +850 -0
  51. package/devices/cy-lighting.js +11 -0
  52. package/devices/danalock.js +26 -0
  53. package/devices/danfoss.js +340 -0
  54. package/devices/databyte.ch.js +55 -0
  55. package/devices/datek.js +246 -0
  56. package/devices/dawon_dns.js +338 -0
  57. package/devices/develco.js +868 -0
  58. package/devices/digi.js +14 -0
  59. package/devices/diyruz.js +305 -0
  60. package/devices/dlink.js +37 -0
  61. package/devices/dnake.js +11 -0
  62. package/devices/dresden_elektronik.js +47 -0
  63. package/devices/easyaccess.js +27 -0
  64. package/devices/eatonhalo_led.js +11 -0
  65. package/devices/echostar.js +25 -0
  66. package/devices/ecodim.js +145 -0
  67. package/devices/ecolink.js +21 -0
  68. package/devices/ecosmart.js +64 -0
  69. package/devices/ecozy.js +31 -0
  70. package/devices/edp.js +39 -0
  71. package/devices/eglo.js +25 -0
  72. package/devices/elko.js +176 -0
  73. package/devices/enbrighten.js +163 -0
  74. package/devices/enocean.js +52 -0
  75. package/devices/envilar.js +73 -0
  76. package/devices/essentialb.js +87 -0
  77. package/devices/eurotronic.js +48 -0
  78. package/devices/evanell.js +29 -0
  79. package/devices/evn.js +31 -0
  80. package/devices/evology.js +24 -0
  81. package/devices/evvr.js +17 -0
  82. package/devices/ewelink.js +184 -0
  83. package/devices/ezex.js +24 -0
  84. package/devices/fantem.js +77 -0
  85. package/devices/feibit.js +172 -0
  86. package/devices/fireangel.js +15 -0
  87. package/devices/frankever.js +23 -0
  88. package/devices/garza.js +11 -0
  89. package/devices/ge.js +111 -0
  90. package/devices/gewiss.js +48 -0
  91. package/devices/gidealed.js +11 -0
  92. package/devices/giderwel.js +11 -0
  93. package/devices/giex.js +222 -0
  94. package/devices/girier.js +19 -0
  95. package/devices/gledopto.js +756 -0
  96. package/devices/gmy.js +11 -0
  97. package/devices/gs.js +29 -0
  98. package/devices/halemeier.js +18 -0
  99. package/devices/hampton_bay.js +37 -0
  100. package/devices/heiman.js +805 -0
  101. package/devices/hej.js +107 -0
  102. package/devices/hfh.js +11 -0
  103. package/devices/hgkg.js +54 -0
  104. package/devices/hilux.js +11 -0
  105. package/devices/hive.js +524 -0
  106. package/devices/home_control_as.js +27 -0
  107. package/devices/hommyn.js +24 -0
  108. package/devices/honyar.js +29 -0
  109. package/devices/hornbach.js +53 -0
  110. package/devices/hzc.js +21 -0
  111. package/devices/hzc_electric.js +42 -0
  112. package/devices/icasa.js +121 -0
  113. package/devices/idinio.js +19 -0
  114. package/devices/ihorn.js +61 -0
  115. package/devices/ikea.js +1168 -0
  116. package/devices/ilightsin.js +11 -0
  117. package/devices/iluminize.js +262 -0
  118. package/devices/ilux.js +11 -0
  119. package/devices/immax.js +203 -0
  120. package/devices/innr.js +705 -0
  121. package/devices/inovelli.js +1315 -0
  122. package/devices/insta.js +110 -0
  123. package/devices/iolloi.js +20 -0
  124. package/devices/iotperfect.js +20 -0
  125. package/devices/iris.js +180 -0
  126. package/devices/istar.js +20 -0
  127. package/devices/jasco.js +55 -0
  128. package/devices/javis.js +37 -0
  129. package/devices/jethome.js +48 -0
  130. package/devices/jiawen.js +18 -0
  131. package/devices/jumitech.js +18 -0
  132. package/devices/jxuan.js +49 -0
  133. package/devices/kami.js +15 -0
  134. package/devices/keen_home.js +80 -0
  135. package/devices/klikaanklikuit.js +17 -0
  136. package/devices/kmpcil.js +148 -0
  137. package/devices/konke.js +141 -0
  138. package/devices/ksentry.js +17 -0
  139. package/devices/kurvia.js +17 -0
  140. package/devices/kwikset.js +120 -0
  141. package/devices/lanesto.js +11 -0
  142. package/devices/lds.js +11 -0
  143. package/devices/led_trading.js +69 -0
  144. package/devices/ledvance.js +353 -0
  145. package/devices/leedarson.js +130 -0
  146. package/devices/legrand.js +554 -0
  147. package/devices/lellki.js +146 -0
  148. package/devices/letsled.js +11 -0
  149. package/devices/letv.js +18 -0
  150. package/devices/leviton.js +142 -0
  151. package/devices/lg.js +18 -0
  152. package/devices/lidl.js +1000 -0
  153. package/devices/lifecontrol.js +92 -0
  154. package/devices/lightsolutions.js +37 -0
  155. package/devices/linkind.js +205 -0
  156. package/devices/livingwise.js +59 -0
  157. package/devices/livolo.js +286 -0
  158. package/devices/lixee.js +779 -0
  159. package/devices/lonsonho.js +218 -0
  160. package/devices/lubeez.js +18 -0
  161. package/devices/lupus.js +74 -0
  162. package/devices/lutron.js +32 -0
  163. package/devices/lux.js +40 -0
  164. package/devices/m-elec.js +18 -0
  165. package/devices/makegood.js +51 -0
  166. package/devices/matcall_bv.js +18 -0
  167. package/devices/meazon.js +47 -0
  168. package/devices/mercator.js +225 -0
  169. package/devices/miboxer.js +72 -0
  170. package/devices/micromatic.js +29 -0
  171. package/devices/moes.js +400 -0
  172. package/devices/mycket.js +11 -0
  173. package/devices/m/303/274ller_licht.js +220 -0
  174. package/devices/namron.js +774 -0
  175. package/devices/nanoleaf.js +11 -0
  176. package/devices/neo.js +86 -0
  177. package/devices/net2grid.js +29 -0
  178. package/devices/netvox.js +35 -0
  179. package/devices/niko.js +314 -0
  180. package/devices/ninja_blocks.js +24 -0
  181. package/devices/niviss.js +11 -0
  182. package/devices/nodon.js +109 -0
  183. package/devices/nordtronic.js +30 -0
  184. package/devices/nous.js +88 -0
  185. package/devices/novo.js +17 -0
  186. package/devices/nue_3a.js +417 -0
  187. package/devices/nyce.js +67 -0
  188. package/devices/onesti.js +59 -0
  189. package/devices/openlumi.js +22 -0
  190. package/devices/orvibo.js +515 -0
  191. package/devices/osram.js +519 -0
  192. package/devices/oujiabao.js +15 -0
  193. package/devices/owon.js +352 -0
  194. package/devices/ozsmartthings.js +11 -0
  195. package/devices/paul_neuhaus.js +96 -0
  196. package/devices/paulmann.js +158 -0
  197. package/devices/peq.js +24 -0
  198. package/devices/perenio.js +413 -0
  199. package/devices/philips.js +3118 -0
  200. package/devices/plaid.js +25 -0
  201. package/devices/plugwise.js +173 -0
  202. package/devices/popp.js +10 -0
  203. package/devices/profalux.js +47 -0
  204. package/devices/prolight.js +54 -0
  205. package/devices/qmotion.js +33 -0
  206. package/devices/qoto.js +113 -0
  207. package/devices/quotra.js +18 -0
  208. package/devices/rademacher.js +18 -0
  209. package/devices/rgb_genie.js +119 -0
  210. package/devices/robb.js +335 -0
  211. package/devices/roome.js +15 -0
  212. package/devices/rtx.js +90 -0
  213. package/devices/salus_controls.js +137 -0
  214. package/devices/samotech.js +93 -0
  215. package/devices/saswell.js +58 -0
  216. package/devices/scanproducts.js +32 -0
  217. package/devices/schlage.js +24 -0
  218. package/devices/schneider_electric.js +1039 -0
  219. package/devices/schwaiger.js +62 -0
  220. package/devices/seastar_intelligence.js +16 -0
  221. package/devices/securifi.js +39 -0
  222. package/devices/sengled.js +332 -0
  223. package/devices/sercomm.js +140 -0
  224. package/devices/shenzhen_homa.js +53 -0
  225. package/devices/shinasystem.js +686 -0
  226. package/devices/siglis.js +440 -0
  227. package/devices/sinope.js +1257 -0
  228. package/devices/siterwell.js +46 -0
  229. package/devices/skydance.js +112 -0
  230. package/devices/slv.js +27 -0
  231. package/devices/smart9.js +27 -0
  232. package/devices/smart_home_pty.js +18 -0
  233. package/devices/smartenit.js +42 -0
  234. package/devices/smartthings.js +495 -0
  235. package/devices/smartwings.js +24 -0
  236. package/devices/sohan_electric.js +13 -0
  237. package/devices/solaredge.js +11 -0
  238. package/devices/somgoms.js +47 -0
  239. package/devices/sonoff.js +262 -0
  240. package/devices/spotmau.js +36 -0
  241. package/devices/sprut.js +317 -0
  242. package/devices/stelpro.js +216 -0
  243. package/devices/sunricher.js +625 -0
  244. package/devices/swann.js +33 -0
  245. package/devices/sylvania.js +200 -0
  246. package/devices/tci.js +25 -0
  247. package/devices/technicolor.js +47 -0
  248. package/devices/terncy.js +64 -0
  249. package/devices/the_light_group.js +70 -0
  250. package/devices/third_reality.js +195 -0
  251. package/devices/titan_products.js +22 -0
  252. package/devices/tplink.js +42 -0
  253. package/devices/trust.js +114 -0
  254. package/devices/tubeszb.js +20 -0
  255. package/devices/tuya.js +4215 -0
  256. package/devices/ubisys.js +938 -0
  257. package/devices/uhome.js +25 -0
  258. package/devices/universal_electronics_inc.js +119 -0
  259. package/devices/urlighting.js +12 -0
  260. package/devices/useelink.js +52 -0
  261. package/devices/vbled.js +18 -0
  262. package/devices/vesternet.js +188 -0
  263. package/devices/viessmann.js +51 -0
  264. package/devices/villeroy_boch.js +18 -0
  265. package/devices/vimar.js +78 -0
  266. package/devices/visonic.js +80 -0
  267. package/devices/vrey.js +18 -0
  268. package/devices/wally.js +25 -0
  269. package/devices/waxman.js +45 -0
  270. package/devices/weiser.js +67 -0
  271. package/devices/weten.js +13 -0
  272. package/devices/wisdom.js +11 -0
  273. package/devices/woox.js +177 -0
  274. package/devices/wyze.js +23 -0
  275. package/devices/xiaomi.js +3223 -0
  276. package/devices/xinghuoyuan.js +11 -0
  277. package/devices/yale.js +227 -0
  278. package/devices/ynoa.js +68 -0
  279. package/devices/yookee.js +23 -0
  280. package/devices/ysrsai.js +26 -0
  281. package/devices/zemismart.js +254 -0
  282. package/devices/zen.js +34 -0
  283. package/devices/zipato.js +11 -0
  284. package/index.js +242 -0
  285. package/lib/color.js +784 -0
  286. package/lib/configureKey.js +944 -0
  287. package/lib/constants.js +316 -0
  288. package/lib/exposes.js +677 -0
  289. package/lib/extend.js +180 -0
  290. package/lib/kelvinToXy.js +1912 -0
  291. package/lib/legacy.js +2223 -0
  292. package/lib/light.js +111 -0
  293. package/lib/ota/OTA_URLs.md +119 -0
  294. package/lib/ota/common.js +476 -0
  295. package/lib/ota/index.js +10 -0
  296. package/lib/ota/inovelli.js +72 -0
  297. package/lib/ota/ledvance.js +52 -0
  298. package/lib/ota/lixee.js +57 -0
  299. package/lib/ota/salus.js +82 -0
  300. package/lib/ota/securifi.js +25 -0
  301. package/lib/ota/tradfri.js +45 -0
  302. package/lib/ota/ubisys.js +61 -0
  303. package/lib/ota/zigbeeOTA.js +161 -0
  304. package/lib/philips.js +667 -0
  305. package/lib/reporting.js +234 -0
  306. package/lib/store.js +57 -0
  307. package/lib/tuya.js +2027 -0
  308. package/lib/utils.js +527 -0
  309. package/lib/xiaomi.d.ts +11 -0
  310. package/lib/xiaomi.js +1288 -0
  311. package/lib/zosung.js +243 -0
  312. package/package.json +39 -0
@@ -0,0 +1,262 @@
1
+ const exposes = require('../lib/exposes');
2
+ const fz = require('../converters/fromZigbee');
3
+ const tz = require('../converters/toZigbee');
4
+ const constants = require('../lib/constants');
5
+ const reporting = require('../lib/reporting');
6
+ const extend = require('../lib/extend');
7
+ const e = exposes.presets;
8
+ const ea = exposes.access;
9
+ const ota = require('../lib/ota');
10
+
11
+ const fzLocal = {
12
+ router_config: {
13
+ cluster: 'genLevelCtrl',
14
+ type: ['attributeReport', 'readResponse'],
15
+ convert: (model, msg, publish, options, meta) => {
16
+ const result = {};
17
+ if (msg.data.hasOwnProperty('currentLevel')) {
18
+ result.light_indicator_level = msg.data['currentLevel'];
19
+ }
20
+ },
21
+ },
22
+ };
23
+
24
+ module.exports = [
25
+ {
26
+ zigbeeModel: ['BASICZBR3'],
27
+ model: 'BASICZBR3',
28
+ vendor: 'SONOFF',
29
+ description: 'Zigbee smart switch',
30
+ extend: extend.switch({disablePowerOnBehavior: true}),
31
+ fromZigbee: [fz.on_off_skip_duplicate_transaction],
32
+ },
33
+ {
34
+ zigbeeModel: ['ZBMINI-L'],
35
+ model: 'ZBMINI-L',
36
+ vendor: 'SONOFF',
37
+ description: 'Zigbee smart switch (no neutral)',
38
+ ota: ota.zigbeeOTA,
39
+ extend: extend.switch(),
40
+ configure: async (device, coordinatorEndpoint, logger) => {
41
+ // Unbind genPollCtrl to prevent device from sending checkin message.
42
+ // Zigbee-herdsmans responds to the checkin message which causes the device
43
+ // to poll slower.
44
+ // https://github.com/Koenkk/zigbee2mqtt/issues/11676
45
+ await device.getEndpoint(1).unbind('genPollCtrl', coordinatorEndpoint);
46
+ device.powerSource = 'Mains (single phase)';
47
+ device.save();
48
+ },
49
+ },
50
+ {
51
+ zigbeeModel: ['ZBMINIL2'],
52
+ model: 'ZBMINIL2',
53
+ vendor: 'SONOFF',
54
+ description: 'Zigbee smart switch (no neutral)',
55
+ ota: ota.zigbeeOTA,
56
+ extend: extend.switch(),
57
+ configure: async (device, coordinatorEndpoint, logger) => {
58
+ // Unbind genPollCtrl to prevent device from sending checkin message.
59
+ // Zigbee-herdsmans responds to the checkin message which causes the device
60
+ // to poll slower.
61
+ // https://github.com/Koenkk/zigbee2mqtt/issues/11676
62
+ await device.getEndpoint(1).unbind('genPollCtrl', coordinatorEndpoint);
63
+ device.powerSource = 'Mains (single phase)';
64
+ device.save();
65
+ },
66
+ },
67
+ {
68
+ zigbeeModel: ['01MINIZB'],
69
+ model: 'ZBMINI',
70
+ vendor: 'SONOFF',
71
+ description: 'Zigbee two way smart switch',
72
+ extend: extend.switch({disablePowerOnBehavior: true}),
73
+ configure: async (device, coordinatorEndpoint, logger) => {
74
+ // Has Unknown power source: https://github.com/Koenkk/zigbee2mqtt/issues/5362, force it here.
75
+ device.powerSource = 'Mains (single phase)';
76
+ device.save();
77
+ },
78
+ },
79
+ {
80
+ zigbeeModel: ['S31 Lite zb'],
81
+ model: 'S31ZB',
82
+ vendor: 'SONOFF',
83
+ description: 'Zigbee smart plug (US version)',
84
+ extend: extend.switch({disablePowerOnBehavior: true}),
85
+ fromZigbee: [fz.on_off_skip_duplicate_transaction],
86
+ configure: async (device, coordinatorEndpoint, logger) => {
87
+ const endpoint = device.getEndpoint(1);
88
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
89
+ },
90
+ },
91
+ {
92
+ fingerprint: [
93
+ // ModelID is from the temperature/humidity sensor (SNZB-02) but this is SNZB-04, wrong modelID in firmware?
94
+ // https://github.com/Koenkk/zigbee-herdsman-converters/issues/1449
95
+ {type: 'EndDevice', manufacturerName: 'eWeLink', modelID: 'TH01', endpoints: [
96
+ {ID: 1, profileID: 260, deviceID: 1026, inputClusters: [0, 3, 1280, 1], outputClusters: [3]},
97
+ ]},
98
+ ],
99
+ zigbeeModel: ['DS01'],
100
+ model: 'SNZB-04',
101
+ vendor: 'SONOFF',
102
+ whiteLabel: [{vendor: 'eWeLink', model: 'RHK06'}],
103
+ description: 'Contact sensor',
104
+ exposes: [e.contact(), e.battery_low(), e.battery(), e.battery_voltage()],
105
+ fromZigbee: [fz.ias_contact_alarm_1, fz.battery],
106
+ toZigbee: [],
107
+ configure: async (device, coordinatorEndpoint, logger) => {
108
+ const endpoint = device.getEndpoint(1);
109
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
110
+ await reporting.batteryVoltage(endpoint, {min: 3600, max: 7200});
111
+ await reporting.batteryPercentageRemaining(endpoint, {min: 3600, max: 7200});
112
+ },
113
+ },
114
+ {
115
+ zigbeeModel: ['WB01', 'WB-01'],
116
+ model: 'SNZB-01',
117
+ vendor: 'SONOFF',
118
+ whiteLabel: [{vendor: 'eWeLink', model: 'RHK07'}],
119
+ description: 'Wireless button',
120
+ exposes: [e.battery(), e.action(['single', 'double', 'long']), e.battery_voltage()],
121
+ fromZigbee: [fz.ewelink_action, fz.battery],
122
+ toZigbee: [],
123
+ configure: async (device, coordinatorEndpoint, logger) => {
124
+ const endpoint = device.getEndpoint(1);
125
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genPowerCfg']);
126
+ await reporting.batteryVoltage(endpoint, {min: 3600, max: 7200});
127
+ await reporting.batteryPercentageRemaining(endpoint, {min: 3600, max: 7200});
128
+ },
129
+ },
130
+ {
131
+ fingerprint: [
132
+ // ModelID is from the button (SNZB-01) but this is SNZB-02, wrong modelID in firmware?
133
+ // https://github.com/Koenkk/zigbee2mqtt/issues/4338
134
+ {type: 'EndDevice', manufacturerName: 'eWeLink', modelID: 'WB01', endpoints: [
135
+ {ID: 1, profileID: 260, deviceID: 770, inputClusters: [0, 3, 1026, 1029, 1], outputClusters: [3]},
136
+ ]},
137
+ {type: 'EndDevice', manufacturerName: 'eWeLink', modelID: '66666', endpoints: [
138
+ {ID: 1, profileID: 260, deviceID: 770, inputClusters: [0, 3, 1026, 1029, 1], outputClusters: [3]},
139
+ ]},
140
+ {type: 'EndDevice', manufacturerName: 'eWeLink', modelID: 'DS01', endpoints: [
141
+ {ID: 1, profileID: 260, deviceID: 770, inputClusters: [0, 3, 1026, 1029, 1], outputClusters: [3]},
142
+ ]},
143
+ ],
144
+ zigbeeModel: ['TH01'],
145
+ model: 'SNZB-02',
146
+ vendor: 'SONOFF',
147
+ whiteLabel: [{vendor: 'eWeLink', model: 'RHK08'}],
148
+ description: 'Temperature and humidity sensor',
149
+ exposes: [e.battery(), e.temperature(), e.humidity(), e.battery_voltage()],
150
+ fromZigbee: [fz.SNZB02_temperature, fz.humidity, fz.battery],
151
+ toZigbee: [],
152
+ configure: async (device, coordinatorEndpoint, logger) => {
153
+ try {
154
+ const endpoint = device.getEndpoint(1);
155
+ const bindClusters = ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg'];
156
+ await reporting.bind(endpoint, coordinatorEndpoint, bindClusters);
157
+ await reporting.temperature(endpoint, {min: 5, max: constants.repInterval.MINUTES_30, change: 20});
158
+ await reporting.humidity(endpoint);
159
+ await reporting.batteryVoltage(endpoint, {min: 3600, max: 7200});
160
+ await reporting.batteryPercentageRemaining(endpoint, {min: 3600, max: 7200});
161
+ } catch (e) {/* Not required for all: https://github.com/Koenkk/zigbee2mqtt/issues/5562 */
162
+ logger.error(`Configure failed: ${e}`);
163
+ }
164
+ },
165
+ },
166
+ {
167
+ zigbeeModel: ['SNZB-02D'],
168
+ model: 'SNZB-02D',
169
+ vendor: 'SONOFF',
170
+ description: 'Temperature and humidity sensor with screen',
171
+ exposes: [e.battery(), e.temperature(), e.humidity()],
172
+ fromZigbee: [fz.temperature, fz.humidity, fz.battery],
173
+ toZigbee: [],
174
+ configure: async (device, coordinatorEndpoint, logger) => {
175
+ const endpoint = device.getEndpoint(1);
176
+ const bindClusters = ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg'];
177
+ await reporting.bind(endpoint, coordinatorEndpoint, bindClusters);
178
+ await reporting.temperature(endpoint, {min: 5, max: constants.repInterval.MINUTES_30, change: 20});
179
+ await reporting.humidity(endpoint);
180
+ await reporting.batteryPercentageRemaining(endpoint, {min: 3600, max: 7200});
181
+ },
182
+ },
183
+ {
184
+ fingerprint: [
185
+ {type: 'EndDevice', manufacturerName: 'eWeLink', modelID: '66666', endpoints: [
186
+ {ID: 1, profileID: 260, deviceID: 1026, inputClusters: [0, 3, 1280, 1], outputClusters: [3]},
187
+ ]},
188
+ ],
189
+ zigbeeModel: ['MS01', 'MSO1'],
190
+ model: 'SNZB-03',
191
+ vendor: 'SONOFF',
192
+ whiteLabel: [{vendor: 'eWeLink', model: 'RHK09'}],
193
+ description: 'Motion sensor',
194
+ fromZigbee: [fz.ias_occupancy_alarm_1, fz.battery],
195
+ toZigbee: [],
196
+ configure: async (device, coordinatorEndpoint, logger) => {
197
+ const endpoint = device.getEndpoint(1);
198
+ const bindClusters = ['genPowerCfg'];
199
+ await reporting.bind(endpoint, coordinatorEndpoint, bindClusters);
200
+ // 3600/7200 prevents disconnect
201
+ // https://github.com/Koenkk/zigbee2mqtt/issues/13600#issuecomment-1283827935
202
+ await reporting.batteryVoltage(endpoint, {min: 3600, max: 7200});
203
+ await reporting.batteryPercentageRemaining(endpoint, {min: 3600, max: 7200});
204
+ },
205
+ exposes: [e.occupancy(), e.battery_low(), e.battery(), e.battery_voltage()],
206
+ },
207
+ {
208
+ zigbeeModel: ['S26R2ZB'],
209
+ model: 'S26R2ZB',
210
+ vendor: 'SONOFF',
211
+ description: 'Zigbee smart plug',
212
+ extend: extend.switch({disablePowerOnBehavior: true}),
213
+ },
214
+ {
215
+ zigbeeModel: ['S40LITE'],
216
+ model: 'S40ZBTPB',
217
+ vendor: 'SONOFF',
218
+ description: '15A Zigbee smart plug',
219
+ extend: extend.switch({disablePowerOnBehavior: true}),
220
+ fromZigbee: [fz.on_off_skip_duplicate_transaction],
221
+ ota: ota.zigbeeOTA,
222
+ configure: async (device, coordinatorEndpoint, logger) => {
223
+ const endpoint = device.getEndpoint(1);
224
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
225
+ },
226
+ },
227
+ {
228
+ zigbeeModel: ['DONGLE-E_R'],
229
+ model: 'ZBDongle-E',
230
+ vendor: 'SONOFF',
231
+ description: 'Sonoff Zigbee 3.0 USB Dongle Plus (EFR32MG21) with router firmware',
232
+ fromZigbee: [fz.linkquality_from_basic, fzLocal.router_config],
233
+ toZigbee: [],
234
+ exposes: [exposes.numeric('light_indicator_level').withDescription('Brightness of the indicator light').withAccess(ea.STATE)],
235
+ configure: async (device, coordinatorEndpoint, logger) => {
236
+ device.powerSource = 'Mains (single phase)';
237
+ device.save();
238
+ },
239
+ },
240
+ {
241
+ zigbeeModel: ['ZBCurtain'],
242
+ model: 'ZBCurtain',
243
+ vendor: 'SONOFF',
244
+ description: 'Zigbee smart curtain motor',
245
+ fromZigbee: [fz.cover_position_tilt, fz.battery],
246
+ toZigbee: [tz.cover_state, tz.cover_position_tilt],
247
+ exposes: [e.cover_position(), e.battery()],
248
+ },
249
+ {
250
+ zigbeeModel: ['Z111PL0H-1JX', 'SA-029-1'],
251
+ model: 'SA-028/SA-029',
252
+ vendor: 'SONOFF',
253
+ whiteLabel: [{vendor: 'Woolley', model: 'SA-029-1'}],
254
+ description: 'Smart Plug',
255
+ extend: extend.switch(),
256
+ configure: async (device, coordinatorEndpoint, logger) => {
257
+ const endpoint = device.getEndpoint(1);
258
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
259
+ await reporting.onOff(endpoint);
260
+ },
261
+ },
262
+ ];
@@ -0,0 +1,36 @@
1
+ const exposes = require('../lib/exposes');
2
+ const reporting = require('../lib/reporting');
3
+ const extend = require('../lib/extend');
4
+ const e = exposes.presets;
5
+
6
+ module.exports = [
7
+ {
8
+ zigbeeModel: ['1719SP-PS1-02'],
9
+ model: 'SP-PS1-02',
10
+ vendor: 'Spotmau',
11
+ description: 'Smart wall switch - 1 gang',
12
+ extend: extend.switch(),
13
+ endpoint: (device) => {
14
+ return {default: 16};
15
+ },
16
+ configure: async (device, coordinatorEndpoint, logger) => {
17
+ await reporting.bind(device.getEndpoint(16), coordinatorEndpoint, ['genOnOff', 'genBasic']);
18
+ },
19
+ },
20
+ {
21
+ zigbeeModel: ['1719SP-PS2-02'],
22
+ model: 'SP-PS2-02',
23
+ vendor: 'Spotmau',
24
+ description: 'Smart wall switch - 2 gang',
25
+ extend: extend.switch(),
26
+ exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right')],
27
+ endpoint: (device) => {
28
+ return {'left': 16, 'right': 17};
29
+ },
30
+ meta: {multiEndpoint: true},
31
+ configure: async (device, coordinatorEndpoint, logger) => {
32
+ await reporting.bind(device.getEndpoint(16), coordinatorEndpoint, ['genOnOff', 'genBasic']);
33
+ await reporting.bind(device.getEndpoint(17), coordinatorEndpoint, ['genOnOff', 'genBasic']);
34
+ },
35
+ },
36
+ ];
@@ -0,0 +1,317 @@
1
+ const exposes = require('../lib/exposes');
2
+ const fz = require('../converters/fromZigbee');
3
+ const tz = require('../converters/toZigbee');
4
+ const reporting = require('../lib/reporting');
5
+ const ota = require('../lib/ota');
6
+ const constants = require('../lib/constants');
7
+ const e = exposes;
8
+ const ep = exposes.presets;
9
+ const eo = exposes.options;
10
+ const ea = exposes.access;
11
+ const {calibrateAndPrecisionRoundOptions, getOptions} = require('../lib/utils');
12
+
13
+ const sprutCode = 0x6666;
14
+ const manufacturerOptions = {manufacturerCode: sprutCode};
15
+ const switchActionValues = ['OFF', 'ON'];
16
+ const co2Lookup = {
17
+ co2_autocalibration: 'sprutCO2AutoCalibration',
18
+ co2_manual_calibration: 'sprutCO2Calibration',
19
+ };
20
+
21
+ const fzLocal = {
22
+ temperature: {
23
+ cluster: 'msTemperatureMeasurement',
24
+ type: ['attributeReport', 'readResponse'],
25
+ options: [eo.precision('temperature'), eo.calibration('temperature')],
26
+ convert: (model, msg, publish, options, meta) => {
27
+ const temperature = parseFloat(msg.data['measuredValue']) / 100.0;
28
+ return {temperature: calibrateAndPrecisionRoundOptions(temperature, options, 'temperature')};
29
+ },
30
+ },
31
+ occupancy_level: {
32
+ cluster: 'msOccupancySensing',
33
+ type: ['readResponse', 'attributeReport'],
34
+ convert: (model, msg, publish, options, meta) => {
35
+ if (msg.data.hasOwnProperty('sprutOccupancyLevel')) {
36
+ return {occupancy_level: msg.data['sprutOccupancyLevel']};
37
+ }
38
+ },
39
+ },
40
+ voc: {
41
+ cluster: 'sprutVoc',
42
+ type: ['readResponse', 'attributeReport'],
43
+ convert: (model, msg, publish, options, meta) => {
44
+ if (msg.data.hasOwnProperty('voc')) {
45
+ return {voc: msg.data['voc']};
46
+ }
47
+ },
48
+ },
49
+ noise: {
50
+ cluster: 'sprutNoise',
51
+ type: ['readResponse', 'attributeReport'],
52
+ convert: (model, msg, publish, options, meta) => {
53
+ if (msg.data.hasOwnProperty('noise')) {
54
+ return {noise: msg.data['noise'].toFixed(2)};
55
+ }
56
+ },
57
+ },
58
+ noise_detected: {
59
+ cluster: 'sprutNoise',
60
+ type: ['readResponse', 'attributeReport'],
61
+ convert: (model, msg, publish, options, meta) => {
62
+ if (msg.data.hasOwnProperty('noiseDetected')) {
63
+ return {noise_detected: msg.data['noiseDetected'] === 1};
64
+ }
65
+ },
66
+ },
67
+ occupancy_timeout: {
68
+ cluster: 'msOccupancySensing',
69
+ type: ['readResponse', 'attributeReport'],
70
+ convert: (model, msg, publish, options, meta) => {
71
+ return {occupancy_timeout: msg.data['pirOToUDelay']};
72
+ },
73
+ },
74
+ noise_timeout: {
75
+ cluster: 'sprutNoise',
76
+ type: ['readResponse', 'attributeReport'],
77
+ convert: (model, msg, publish, options, meta) => {
78
+ return {noise_timeout: msg.data['noiseAfterDetectDelay']};
79
+ },
80
+ },
81
+ occupancy_sensitivity: {
82
+ cluster: 'msOccupancySensing',
83
+ type: ['readResponse', 'attributeReport'],
84
+ convert: (model, msg, publish, options, meta) => {
85
+ return {occupancy_sensitivity: msg.data['sprutOccupancySensitivity']};
86
+ },
87
+ },
88
+ noise_detect_level: {
89
+ cluster: 'sprutNoise',
90
+ type: ['readResponse', 'attributeReport'],
91
+ convert: (model, msg, publish, options, meta) => {
92
+ return {noise_detect_level: msg.data['noiseDetectLevel']};
93
+ },
94
+ },
95
+ co2_config: {
96
+ key: ['co2_autocalibration', 'co2_manual_calibration'],
97
+ cluster: 'msCO2',
98
+ type: ['attributeReport', 'readResponse'],
99
+ convert: (model, msg, publish, options, meta) => {
100
+ if (msg.data.hasOwnProperty('sprutCO2AutoCalibration')) {
101
+ return {co2_autocalibration: switchActionValues[msg.data['sprutCO2AutoCalibration']]};
102
+ }
103
+ if (msg.data.hasOwnProperty('sprutCO2Calibration')) {
104
+ return {co2_manual_calibration: switchActionValues[msg.data['sprutCO2Calibration']]};
105
+ }
106
+ },
107
+ },
108
+ th_heater: {
109
+ key: ['th_heater'],
110
+ cluster: 'msRelativeHumidity',
111
+ type: ['attributeReport', 'readResponse'],
112
+ convert: (model, msg, publish, options, meta) => {
113
+ if (msg.data.hasOwnProperty('sprutHeater')) {
114
+ return {th_heater: switchActionValues[msg.data['sprutHeater']]};
115
+ }
116
+ },
117
+ },
118
+ };
119
+
120
+ const tzLocal = {
121
+ sprut_ir_remote: {
122
+ key: ['play_store', 'learn_start', 'learn_stop', 'clear_store', 'play_ram', 'learn_ram_start', 'learn_ram_stop'],
123
+ convertSet: async (entity, key, value, meta) => {
124
+ const options = {
125
+ frameType: 0, manufacturerCode: sprutCode, disableDefaultResponse: true,
126
+ disableResponse: true, reservedBits: 0, direction: 0, writeUndiv: false,
127
+ transactionSequenceNumber: null,
128
+ };
129
+
130
+ switch (key) {
131
+ case 'play_store':
132
+ await entity.command('sprutIrBlaster', 'playStore',
133
+ {param: value['rom']}, options);
134
+ break;
135
+ case 'learn_start':
136
+ await entity.command('sprutIrBlaster', 'learnStart',
137
+ {value: value['rom']}, options);
138
+ break;
139
+ case 'learn_stop':
140
+ await entity.command('sprutIrBlaster', 'learnStop',
141
+ {value: value['rom']}, options);
142
+ break;
143
+ case 'clear_store':
144
+ await entity.command('sprutIrBlaster', 'clearStore',
145
+ {}, options);
146
+ break;
147
+ case 'play_ram':
148
+ await entity.command('sprutIrBlaster', 'playRam',
149
+ {}, options);
150
+ break;
151
+ case 'learn_ram_start':
152
+ await entity.command('sprutIrBlaster', 'learnRamStart',
153
+ {}, options);
154
+ break;
155
+ case 'learn_ram_stop':
156
+ await entity.command('sprutIrBlaster', 'learnRamStop',
157
+ {}, options);
158
+ break;
159
+ }
160
+ },
161
+ },
162
+ occupancy_timeout: {
163
+ key: ['occupancy_timeout'],
164
+ convertSet: async (entity, key, value, meta) => {
165
+ value *= 1;
166
+ await entity.write('msOccupancySensing', {pirOToUDelay: value}, getOptions(meta.mapped, entity));
167
+ return {state: {[key]: value}};
168
+ },
169
+ convertGet: async (entity, key, meta) => {
170
+ await entity.read('msOccupancySensing', ['pirOToUDelay']);
171
+ },
172
+ },
173
+ noise_timeout: {
174
+ key: ['noise_timeout'],
175
+ convertSet: async (entity, key, value, meta) => {
176
+ value *= 1;
177
+ await entity.write('sprutNoise', {noiseAfterDetectDelay: value}, getOptions(meta.mapped, entity));
178
+ return {state: {[key]: value}};
179
+ },
180
+ convertGet: async (entity, key, meta) => {
181
+ await entity.read('sprutNoise', ['noiseAfterDetectDelay']);
182
+ },
183
+ },
184
+ occupancy_sensitivity: {
185
+ key: ['occupancy_sensitivity'],
186
+ convertSet: async (entity, key, value, meta) => {
187
+ value *= 1;
188
+ const options = getOptions(meta.mapped, entity, manufacturerOptions);
189
+ await entity.write('msOccupancySensing', {'sprutOccupancySensitivity': value}, options);
190
+ return {state: {[key]: value}};
191
+ },
192
+ convertGet: async (entity, key, meta) => {
193
+ await entity.read('msOccupancySensing', ['sprutOccupancySensitivity'], manufacturerOptions);
194
+ },
195
+ },
196
+ noise_detect_level: {
197
+ key: ['noise_detect_level'],
198
+ convertSet: async (entity, key, value, meta) => {
199
+ value *= 1;
200
+ const options = getOptions(meta.mapped, entity, manufacturerOptions);
201
+ await entity.write('sprutNoise', {'noiseDetectLevel': value}, options);
202
+ return {state: {[key]: value}};
203
+ },
204
+ convertGet: async (entity, key, meta) => {
205
+ await entity.read('sprutNoise', ['noiseDetectLevel'], manufacturerOptions);
206
+ },
207
+ },
208
+ temperature_offset: {
209
+ key: ['temperature_offset'],
210
+ convertSet: async (entity, key, value, meta) => {
211
+ value *= 1;
212
+ const newValue = parseFloat(value) * 100.0;
213
+ const options = getOptions(meta.mapped, entity, manufacturerOptions);
214
+ await entity.write('msTemperatureMeasurement', {'sprutTemperatureOffset': newValue}, options);
215
+ return {state: {[key]: value}};
216
+ },
217
+ },
218
+ co2_config: {
219
+ key: ['co2_autocalibration', 'co2_manual_calibration'],
220
+ convertSet: async (entity, key, value, meta) => {
221
+ let newValue = value;
222
+ newValue = switchActionValues.indexOf(value);
223
+ const options = getOptions(meta.mapped, entity, manufacturerOptions);
224
+ await entity.write('msCO2', {[co2Lookup[key]]: newValue}, options);
225
+
226
+
227
+ return {state: {[key]: value}};
228
+ },
229
+ convertGet: async (entity, key, meta) => {
230
+ await entity.read('msCO2', [co2Lookup[key]], manufacturerOptions);
231
+ },
232
+ },
233
+ th_heater: {
234
+ key: ['th_heater'],
235
+ convertSet: async (entity, key, value, meta) => {
236
+ let newValue = value;
237
+ newValue = switchActionValues.indexOf(value);
238
+ const options = getOptions(meta.mapped, entity, manufacturerOptions);
239
+ await entity.write('msRelativeHumidity', {'sprutHeater': newValue}, options);
240
+
241
+ return {state: {[key]: value}};
242
+ },
243
+ convertGet: async (entity, key, meta) => {
244
+ await entity.read('msRelativeHumidity', ['sprutHeater'], manufacturerOptions);
245
+ },
246
+ },
247
+ };
248
+
249
+ module.exports = [
250
+ {
251
+ zigbeeModel: ['WBMSW3'],
252
+ model: 'WB-MSW-ZIGBEE v.3',
253
+ vendor: 'Sprut.device',
254
+ description: 'Wall-mounted Zigbee sensor',
255
+ fromZigbee: [fzLocal.temperature, fz.illuminance, fz.humidity, fz.occupancy, fzLocal.occupancy_level, fz.co2, fzLocal.voc,
256
+ fzLocal.noise, fzLocal.noise_detected, fz.on_off, fzLocal.occupancy_timeout, fzLocal.noise_timeout, fzLocal.co2_config,
257
+ fzLocal.th_heater, fzLocal.occupancy_sensitivity, fzLocal.noise_detect_level],
258
+ toZigbee: [tz.on_off, tzLocal.sprut_ir_remote, tzLocal.occupancy_timeout, tzLocal.noise_timeout, tzLocal.co2_config,
259
+ tzLocal.th_heater, tzLocal.temperature_offset, tzLocal.occupancy_sensitivity, tzLocal.noise_detect_level],
260
+ exposes: [ep.temperature(), ep.illuminance(), ep.illuminance_lux(), ep.humidity(), ep.occupancy(), ep.occupancy_level(), ep.co2(),
261
+ ep.voc(), ep.noise(), ep.noise_detected(ea.STATE_GET), ep.switch().withEndpoint('l1'), ep.switch().withEndpoint('l2'),
262
+ ep.switch().withEndpoint('l3'),
263
+ e.numeric('noise_timeout', ea.ALL).withValueMin(0).withValueMax(2000).withUnit('s')
264
+ .withDescription('Time in seconds after which noise is cleared after detecting it (default: 60)'),
265
+ e.numeric('occupancy_timeout', ea.ALL).withValueMin(0).withValueMax(2000).withUnit('s')
266
+ .withDescription('Time in seconds after which occupancy is cleared after detecting it (default: 60)'),
267
+ e.numeric('temperature_offset', ea.SET).withValueMin(-10).withValueMax(10).withUnit('°C')
268
+ .withDescription('Self-heating compensation. The compensation value is subtracted from the measured temperature'),
269
+ e.numeric('occupancy_sensitivity', ea.ALL).withValueMin(0).withValueMax(2000)
270
+ .withDescription('If the sensor is triggered by the slightest movement, reduce the sensitivity, '+
271
+ 'otherwise increase it (default: 50)'),
272
+ e.numeric('noise_detect_level', ea.ALL).withValueMin(0).withValueMax(150).withUnit('dBA')
273
+ .withDescription('The minimum noise level at which the detector will work (default: 50)'),
274
+ e.enum('co2_autocalibration', ea.ALL, switchActionValues)
275
+ .withDescription('Automatic calibration of the CO2 sensor. If ON, the CO2 sensor will automatically calibrate '+
276
+ 'every 7 days. (MH-Z19B sensor)'),
277
+ e.enum('co2_manual_calibration', ea.ALL, switchActionValues)
278
+ .withDescription('Ventilate the room for 20 minutes, turn on manual calibration, and turn it off after one second. '+
279
+ 'After about 5 minutes the CO2 sensor will show 400ppm. Calibration completed. (MH-Z19B sensor)'),
280
+ e.enum('th_heater', ea.ALL, switchActionValues)
281
+ .withDescription('Turn on when working in conditions of high humidity (more than 70 %, RH) or condensation, '+
282
+ 'if the sensor shows 0 or 100 %.'),
283
+ ],
284
+ configure: async (device, coordinatorEndpoint, logger) => {
285
+ const endpoint1 = device.getEndpoint(1);
286
+ const binds = ['genBasic', 'msTemperatureMeasurement', 'msIlluminanceMeasurement', 'msRelativeHumidity',
287
+ 'msOccupancySensing', 'msCO2', 'sprutVoc', 'sprutNoise', 'sprutIrBlaster', 'genOta'];
288
+ await reporting.bind(endpoint1, coordinatorEndpoint, binds);
289
+
290
+ // report configuration
291
+ await reporting.temperature(endpoint1);
292
+ await reporting.illuminance(endpoint1);
293
+ await reporting.humidity(endpoint1);
294
+ await reporting.occupancy(endpoint1);
295
+
296
+ let payload = reporting.payload('sprutOccupancyLevel', 10, constants.repInterval.MINUTE, 5);
297
+ await endpoint1.configureReporting('msOccupancySensing', payload, manufacturerOptions);
298
+
299
+ payload = reporting.payload('noise', 10, constants.repInterval.MINUTE, 5);
300
+ await endpoint1.configureReporting('sprutNoise', payload);
301
+
302
+ // led_red
303
+ await device.getEndpoint(2).read('genOnOff', ['onOff']);
304
+
305
+ // led_green
306
+ await device.getEndpoint(3).read('genOnOff', ['onOff']);
307
+
308
+ // buzzer
309
+ await device.getEndpoint(4).read('genOnOff', ['onOff']);
310
+ },
311
+ endpoint: (device) => {
312
+ return {'default': 1, 'l1': 2, 'l2': 3, 'l3': 4};
313
+ },
314
+ meta: {multiEndpoint: true},
315
+ ota: ota.zigbeeOTA,
316
+ },
317
+ ];