zigbee-herdsman-converters 14.0.354 → 14.0.355
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/converters/fromZigbee.js +27 -0
- package/index.js +2 -2
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/converters/fromZigbee.js
CHANGED
|
@@ -1035,6 +1035,7 @@ const converters = {
|
|
|
1035
1035
|
cluster: 'genScenes',
|
|
1036
1036
|
type: 'commandRecall',
|
|
1037
1037
|
convert: (model, msg, publish, options, meta) => {
|
|
1038
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1038
1039
|
const payload = {action: postfixWithEndpointName(`recall_${msg.data.sceneid}`, msg, model)};
|
|
1039
1040
|
addActionGroup(payload, msg, model);
|
|
1040
1041
|
return payload;
|
|
@@ -1044,6 +1045,7 @@ const converters = {
|
|
|
1044
1045
|
cluster: 'ssIasAce',
|
|
1045
1046
|
type: 'commandPanic',
|
|
1046
1047
|
convert: (model, msg, publish, options, meta) => {
|
|
1048
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1047
1049
|
const payload = {action: postfixWithEndpointName(`panic`, msg, model)};
|
|
1048
1050
|
addActionGroup(payload, msg, model);
|
|
1049
1051
|
return payload;
|
|
@@ -1067,6 +1069,7 @@ const converters = {
|
|
|
1067
1069
|
cluster: 'ssIasAce',
|
|
1068
1070
|
type: 'commandArm',
|
|
1069
1071
|
convert: (model, msg, publish, options, meta) => {
|
|
1072
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1070
1073
|
const payload = converters.command_arm.convert(model, msg, publish, options, meta);
|
|
1071
1074
|
if (!payload) return;
|
|
1072
1075
|
payload.action_transaction = msg.meta.zclTransactionSequenceNumber;
|
|
@@ -1077,6 +1080,7 @@ const converters = {
|
|
|
1077
1080
|
cluster: 'closuresWindowCovering',
|
|
1078
1081
|
type: 'commandStop',
|
|
1079
1082
|
convert: (model, msg, publish, options, meta) => {
|
|
1083
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1080
1084
|
const payload = {action: postfixWithEndpointName('stop', msg, model)};
|
|
1081
1085
|
addActionGroup(payload, msg, model);
|
|
1082
1086
|
return payload;
|
|
@@ -1086,6 +1090,7 @@ const converters = {
|
|
|
1086
1090
|
cluster: 'closuresWindowCovering',
|
|
1087
1091
|
type: 'commandUpOpen',
|
|
1088
1092
|
convert: (model, msg, publish, options, meta) => {
|
|
1093
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1089
1094
|
const payload = {action: postfixWithEndpointName('open', msg, model)};
|
|
1090
1095
|
addActionGroup(payload, msg, model);
|
|
1091
1096
|
return payload;
|
|
@@ -1095,6 +1100,7 @@ const converters = {
|
|
|
1095
1100
|
cluster: 'closuresWindowCovering',
|
|
1096
1101
|
type: 'commandDownClose',
|
|
1097
1102
|
convert: (model, msg, publish, options, meta) => {
|
|
1103
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1098
1104
|
const payload = {action: postfixWithEndpointName('close', msg, model)};
|
|
1099
1105
|
addActionGroup(payload, msg, model);
|
|
1100
1106
|
return payload;
|
|
@@ -1104,6 +1110,7 @@ const converters = {
|
|
|
1104
1110
|
cluster: 'genOnOff',
|
|
1105
1111
|
type: 'commandOn',
|
|
1106
1112
|
convert: (model, msg, publish, options, meta) => {
|
|
1113
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1107
1114
|
const payload = {action: postfixWithEndpointName('on', msg, model)};
|
|
1108
1115
|
addActionGroup(payload, msg, model);
|
|
1109
1116
|
return payload;
|
|
@@ -1113,6 +1120,7 @@ const converters = {
|
|
|
1113
1120
|
cluster: 'genOnOff',
|
|
1114
1121
|
type: 'commandOff',
|
|
1115
1122
|
convert: (model, msg, publish, options, meta) => {
|
|
1123
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1116
1124
|
const payload = {action: postfixWithEndpointName('off', msg, model)};
|
|
1117
1125
|
addActionGroup(payload, msg, model);
|
|
1118
1126
|
return payload;
|
|
@@ -1122,6 +1130,7 @@ const converters = {
|
|
|
1122
1130
|
cluster: 'genOnOff',
|
|
1123
1131
|
type: 'commandOffWithEffect',
|
|
1124
1132
|
convert: (model, msg, publish, options, meta) => {
|
|
1133
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1125
1134
|
const payload = {action: postfixWithEndpointName(`off`, msg, model)};
|
|
1126
1135
|
addActionGroup(payload, msg, model);
|
|
1127
1136
|
return payload;
|
|
@@ -1131,6 +1140,7 @@ const converters = {
|
|
|
1131
1140
|
cluster: 'genOnOff',
|
|
1132
1141
|
type: 'commandToggle',
|
|
1133
1142
|
convert: (model, msg, publish, options, meta) => {
|
|
1143
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1134
1144
|
const payload = {action: postfixWithEndpointName('toggle', msg, model)};
|
|
1135
1145
|
addActionGroup(payload, msg, model);
|
|
1136
1146
|
return payload;
|
|
@@ -1141,6 +1151,7 @@ const converters = {
|
|
|
1141
1151
|
type: ['commandMoveToLevel', 'commandMoveToLevelWithOnOff'],
|
|
1142
1152
|
options: [exposes.options.simulated_brightness()],
|
|
1143
1153
|
convert: (model, msg, publish, options, meta) => {
|
|
1154
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1144
1155
|
const payload = {
|
|
1145
1156
|
action: postfixWithEndpointName(`brightness_move_to_level`, msg, model),
|
|
1146
1157
|
action_level: msg.data.level,
|
|
@@ -1161,6 +1172,7 @@ const converters = {
|
|
|
1161
1172
|
type: ['commandMove', 'commandMoveWithOnOff'],
|
|
1162
1173
|
options: [exposes.options.simulated_brightness()],
|
|
1163
1174
|
convert: (model, msg, publish, options, meta) => {
|
|
1175
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1164
1176
|
const direction = msg.data.movemode === 1 ? 'down' : 'up';
|
|
1165
1177
|
const action = postfixWithEndpointName(`brightness_move_${direction}`, msg, model);
|
|
1166
1178
|
const payload = {action, action_rate: msg.data.rate};
|
|
@@ -1195,6 +1207,7 @@ const converters = {
|
|
|
1195
1207
|
type: ['commandStep', 'commandStepWithOnOff'],
|
|
1196
1208
|
options: [exposes.options.simulated_brightness()],
|
|
1197
1209
|
convert: (model, msg, publish, options, meta) => {
|
|
1210
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1198
1211
|
const direction = msg.data.stepmode === 1 ? 'down' : 'up';
|
|
1199
1212
|
const payload = {
|
|
1200
1213
|
action: postfixWithEndpointName(`brightness_step_${direction}`, msg, model),
|
|
@@ -1220,6 +1233,7 @@ const converters = {
|
|
|
1220
1233
|
type: ['commandStop', 'commandStopWithOnOff'],
|
|
1221
1234
|
options: [exposes.options.simulated_brightness()],
|
|
1222
1235
|
convert: (model, msg, publish, options, meta) => {
|
|
1236
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1223
1237
|
if (options.simulated_brightness) {
|
|
1224
1238
|
clearInterval(globalStore.getValue(msg.endpoint, 'simulated_brightness_timer'));
|
|
1225
1239
|
globalStore.putValue(msg.endpoint, 'simulated_brightness_timer', undefined);
|
|
@@ -1234,6 +1248,7 @@ const converters = {
|
|
|
1234
1248
|
cluster: 'lightingColorCtrl',
|
|
1235
1249
|
type: ['commandMoveColorTemp'],
|
|
1236
1250
|
convert: (model, msg, publish, options, meta) => {
|
|
1251
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1237
1252
|
const direction = msg.data.movemode === 1 ? 'down' : 'up';
|
|
1238
1253
|
const action = postfixWithEndpointName(`color_temperature_move_${direction}`, msg, model);
|
|
1239
1254
|
const payload = {action, action_rate: msg.data.rate, action_minimum: msg.data.minimum, action_maximum: msg.data.maximum};
|
|
@@ -1245,6 +1260,7 @@ const converters = {
|
|
|
1245
1260
|
cluster: 'lightingColorCtrl',
|
|
1246
1261
|
type: 'commandStepColorTemp',
|
|
1247
1262
|
convert: (model, msg, publish, options, meta) => {
|
|
1263
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1248
1264
|
const direction = msg.data.stepmode === 1 ? 'up' : 'down';
|
|
1249
1265
|
const payload = {
|
|
1250
1266
|
action: postfixWithEndpointName(`color_temperature_step_${direction}`, msg, model),
|
|
@@ -1263,6 +1279,7 @@ const converters = {
|
|
|
1263
1279
|
cluster: 'lightingColorCtrl',
|
|
1264
1280
|
type: 'commandEnhancedMoveToHueAndSaturation',
|
|
1265
1281
|
convert: (model, msg, publish, options, meta) => {
|
|
1282
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1266
1283
|
const payload = {
|
|
1267
1284
|
action: postfixWithEndpointName(`enhanced_move_to_hue_and_saturation`, msg, model),
|
|
1268
1285
|
action_enhanced_hue: msg.data.enhancehue,
|
|
@@ -1279,6 +1296,7 @@ const converters = {
|
|
|
1279
1296
|
cluster: 'lightingColorCtrl',
|
|
1280
1297
|
type: ['commandStepHue'],
|
|
1281
1298
|
convert: (model, msg, publish, options, meta) => {
|
|
1299
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1282
1300
|
const direction = msg.data.stepmode === 1 ? 'up' : 'down';
|
|
1283
1301
|
const payload = {
|
|
1284
1302
|
action: postfixWithEndpointName(`color_hue_step_${direction}`, msg, model),
|
|
@@ -1293,6 +1311,7 @@ const converters = {
|
|
|
1293
1311
|
cluster: 'lightingColorCtrl',
|
|
1294
1312
|
type: ['commandStepSaturation'],
|
|
1295
1313
|
convert: (model, msg, publish, options, meta) => {
|
|
1314
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1296
1315
|
const direction = msg.data.stepmode === 1 ? 'up' : 'down';
|
|
1297
1316
|
const payload = {
|
|
1298
1317
|
action: postfixWithEndpointName(`color_saturation_step_${direction}`, msg, model),
|
|
@@ -1307,6 +1326,7 @@ const converters = {
|
|
|
1307
1326
|
cluster: 'lightingColorCtrl',
|
|
1308
1327
|
type: 'commandColorLoopSet',
|
|
1309
1328
|
convert: (model, msg, publish, options, meta) => {
|
|
1329
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1310
1330
|
const updateFlags = msg.data.updateflags;
|
|
1311
1331
|
const actionLookup = {
|
|
1312
1332
|
0x00: 'deactivate',
|
|
@@ -1336,6 +1356,7 @@ const converters = {
|
|
|
1336
1356
|
cluster: 'lightingColorCtrl',
|
|
1337
1357
|
type: 'commandMoveToColorTemp',
|
|
1338
1358
|
convert: (model, msg, publish, options, meta) => {
|
|
1359
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1339
1360
|
const payload = {
|
|
1340
1361
|
action: postfixWithEndpointName(`color_temperature_move`, msg, model),
|
|
1341
1362
|
action_color_temperature: msg.data.colortemp,
|
|
@@ -1349,6 +1370,7 @@ const converters = {
|
|
|
1349
1370
|
cluster: 'lightingColorCtrl',
|
|
1350
1371
|
type: 'commandMoveToColor',
|
|
1351
1372
|
convert: (model, msg, publish, options, meta) => {
|
|
1373
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1352
1374
|
const payload = {
|
|
1353
1375
|
action: postfixWithEndpointName(`color_move`, msg, model),
|
|
1354
1376
|
action_color: {
|
|
@@ -1365,6 +1387,7 @@ const converters = {
|
|
|
1365
1387
|
cluster: 'lightingColorCtrl',
|
|
1366
1388
|
type: 'commandMoveHue',
|
|
1367
1389
|
convert: (model, msg, publish, options, meta) => {
|
|
1390
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1368
1391
|
const movestop = msg.data.movemode == 1 ? 'move' : 'stop';
|
|
1369
1392
|
const action = postfixWithEndpointName(`hue_${movestop}`, msg, model);
|
|
1370
1393
|
const payload = {action, action_rate: msg.data.rate};
|
|
@@ -1376,6 +1399,7 @@ const converters = {
|
|
|
1376
1399
|
cluster: 'lightingColorCtrl',
|
|
1377
1400
|
type: 'commandMoveToSaturation',
|
|
1378
1401
|
convert: (model, msg, publish, options, meta) => {
|
|
1402
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1379
1403
|
const payload = {
|
|
1380
1404
|
action: postfixWithEndpointName('move_to_saturation', msg, model),
|
|
1381
1405
|
action_saturation: msg.data.saturation,
|
|
@@ -1389,6 +1413,7 @@ const converters = {
|
|
|
1389
1413
|
cluster: 'lightingColorCtrl',
|
|
1390
1414
|
type: 'commandMoveToHue',
|
|
1391
1415
|
convert: (model, msg, publish, options, meta) => {
|
|
1416
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1392
1417
|
const payload = {
|
|
1393
1418
|
action: postfixWithEndpointName(`move_to_hue`, msg, model),
|
|
1394
1419
|
action_hue: msg.data.hue,
|
|
@@ -1413,6 +1438,7 @@ const converters = {
|
|
|
1413
1438
|
cluster: 'genOnOff',
|
|
1414
1439
|
type: 'commandOn',
|
|
1415
1440
|
convert: (model, msg, publish, options, meta) => {
|
|
1441
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1416
1442
|
const property = postfixWithEndpointName('state', msg, model);
|
|
1417
1443
|
return {[property]: 'ON'};
|
|
1418
1444
|
},
|
|
@@ -1421,6 +1447,7 @@ const converters = {
|
|
|
1421
1447
|
cluster: 'genOnOff',
|
|
1422
1448
|
type: 'commandOff',
|
|
1423
1449
|
convert: (model, msg, publish, options, meta) => {
|
|
1450
|
+
if (hasAlreadyProcessedMessage(msg)) return;
|
|
1424
1451
|
const property = postfixWithEndpointName('state', msg, model);
|
|
1425
1452
|
return {[property]: 'OFF'};
|
|
1426
1453
|
},
|
package/index.js
CHANGED
|
@@ -46,7 +46,6 @@ const converterRequiredFields = {
|
|
|
46
46
|
description: 'String',
|
|
47
47
|
fromZigbee: 'Array',
|
|
48
48
|
toZigbee: 'Array',
|
|
49
|
-
exposes: 'Array',
|
|
50
49
|
};
|
|
51
50
|
|
|
52
51
|
function validateDefinition(definition) {
|
|
@@ -56,6 +55,7 @@ function validateDefinition(definition) {
|
|
|
56
55
|
const msg = `Converter field ${field} expected type doenst match to ${definition[field]}`;
|
|
57
56
|
assert.strictEqual(definition[field].constructor.name, expectedType, msg);
|
|
58
57
|
}
|
|
58
|
+
assert.ok(Array.isArray(definition.exposes) || typeof definition.exposes === 'function', 'Exposes incorrect');
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function addDefinition(definition) {
|
|
@@ -77,7 +77,7 @@ function addDefinition(definition) {
|
|
|
77
77
|
|
|
78
78
|
definition.toZigbee.push(tz.scene_store, tz.scene_recall, tz.scene_add, tz.scene_remove, tz.scene_remove_all, tz.read, tz.write);
|
|
79
79
|
|
|
80
|
-
if (definition.exposes) {
|
|
80
|
+
if (definition.exposes && Array.isArray(definition.exposes)) {
|
|
81
81
|
definition.exposes = definition.exposes.concat([exposes.presets.linkquality()]);
|
|
82
82
|
}
|
|
83
83
|
|
package/npm-shrinkwrap.json
CHANGED