zigbee-herdsman-converters 14.0.378 → 14.0.379
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/philips.js +9 -0
- package/devices/tuya.js +5 -2
- package/lib/ota/zigbeeOTA.js +32 -7
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/devices/philips.js
CHANGED
|
@@ -29,6 +29,15 @@ const hueExtend = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
module.exports = [
|
|
32
|
+
{
|
|
33
|
+
zigbeeModel: ['LCX004'],
|
|
34
|
+
model: '929002994901',
|
|
35
|
+
vendor: 'Philips',
|
|
36
|
+
description: 'Hue gradient lightstrip',
|
|
37
|
+
meta: {turnsOffAtBrightness1: true},
|
|
38
|
+
extend: hueExtend.light_onoff_brightness_colortemp_color({colorTempRange: [153, 500]}),
|
|
39
|
+
ota: ota.zigbeeOTA,
|
|
40
|
+
},
|
|
32
41
|
{
|
|
33
42
|
zigbeeModel: ['929003047501'],
|
|
34
43
|
model: '929003047501',
|
package/devices/tuya.js
CHANGED
|
@@ -162,7 +162,8 @@ module.exports = [
|
|
|
162
162
|
{modelID: 'TS0505B', manufacturerName: '_TZ3210_0rn9qhnu'},
|
|
163
163
|
{modelID: 'TS0505B', manufacturerName: '_TZ3210_bicjqpg4'},
|
|
164
164
|
{modelID: 'TS0505B', manufacturerName: '_TZ3000_cmaky9gq'},
|
|
165
|
-
{modelID: 'TS0505B', manufacturerName: '_TZ3000_tza2vjxx'}
|
|
165
|
+
{modelID: 'TS0505B', manufacturerName: '_TZ3000_tza2vjxx'},
|
|
166
|
+
{modelID: 'TS0505B', manufacturerName: '_TZ3210_bfwvfyx1'}],
|
|
166
167
|
model: 'TS0505B',
|
|
167
168
|
vendor: 'TuYa',
|
|
168
169
|
description: 'Zigbee RGB+CCT light',
|
|
@@ -177,6 +178,7 @@ module.exports = [
|
|
|
177
178
|
{
|
|
178
179
|
fingerprint: [{modelID: 'TS0503B', manufacturerName: '_TZ3000_i8l0nqdu'},
|
|
179
180
|
{modelID: 'TS0503B', manufacturerName: '_TZ3210_a5fxguxr'},
|
|
181
|
+
{modelID: 'TS0503B', manufacturerName: '_TZ3210_778drfdt'},
|
|
180
182
|
{modelID: 'TS0503B', manufacturerName: '_TZ3000_g5xawfcq'}],
|
|
181
183
|
model: 'TS0503B',
|
|
182
184
|
vendor: 'TuYa',
|
|
@@ -309,7 +311,8 @@ module.exports = [
|
|
|
309
311
|
],
|
|
310
312
|
},
|
|
311
313
|
{
|
|
312
|
-
fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_oiymh3qu'}
|
|
314
|
+
fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_oiymh3qu'},
|
|
315
|
+
{modelID: 'TS011F', manufacturerName: '_TZ3000_o1jzcxou'}],
|
|
313
316
|
model: 'TS011F_socket_module',
|
|
314
317
|
vendor: 'TuYa',
|
|
315
318
|
description: 'Socket module',
|
package/lib/ota/zigbeeOTA.js
CHANGED
|
@@ -4,8 +4,10 @@ const common = require('./common');
|
|
|
4
4
|
const axios = common.getAxios();
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const URI = require('uri-js');
|
|
7
|
+
const path = require('path');
|
|
7
8
|
|
|
8
|
-
let
|
|
9
|
+
let overrideIndexFileName = null;
|
|
10
|
+
let dataDir = null;
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Helper functions
|
|
@@ -22,7 +24,7 @@ function isValidUrl(url) {
|
|
|
22
24
|
return parsed.scheme === 'http' || parsed.scheme === 'https';
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
async function
|
|
27
|
+
async function getIndexFile(urlOrName) {
|
|
26
28
|
if (isValidUrl(urlOrName)) {
|
|
27
29
|
return (await axios.get(urlOrName)).data;
|
|
28
30
|
}
|
|
@@ -30,14 +32,33 @@ async function getFile(urlOrName) {
|
|
|
30
32
|
return JSON.parse(fs.readFileSync(urlOrName));
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
async function getFirmwareFile(image, logger) {
|
|
36
|
+
let urlOrName = image.url;
|
|
37
|
+
|
|
38
|
+
// First try to download firmware file with the URL provided
|
|
39
|
+
if (isValidUrl(urlOrName)) {
|
|
40
|
+
logger.debug(`ZigbeeOTA: downloading firmware image from ${urlOrName}`);
|
|
41
|
+
return await axios.get(urlOrName, {responseType: 'arraybuffer'});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// If the file name is not a full path, then treat it as a relative to the data directory
|
|
45
|
+
if (!path.isAbsolute(urlOrName) && dataDir) {
|
|
46
|
+
urlOrName = path.join(dataDir, urlOrName);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
logger.debug(`ZigbeeOTA: getting local firmware file ${urlOrName}`);
|
|
50
|
+
return {data: fs.readFileSync(urlOrName)};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
33
54
|
async function getIndex(logger) {
|
|
34
55
|
const index = (await axios.get(url)).data;
|
|
35
56
|
|
|
36
57
|
logger.debug(`ZigbeeOTA: downloaded main index`);
|
|
37
58
|
|
|
38
|
-
if (
|
|
39
|
-
logger.debug(`ZigbeeOTA: Loading override index ${
|
|
40
|
-
const localIndex = await
|
|
59
|
+
if (overrideIndexFileName) {
|
|
60
|
+
logger.debug(`ZigbeeOTA: Loading override index ${overrideIndexFileName}`);
|
|
61
|
+
const localIndex = await getIndexFile(overrideIndexFileName);
|
|
41
62
|
|
|
42
63
|
// Resulting index will have overriden items first
|
|
43
64
|
return localIndex.concat(index);
|
|
@@ -58,6 +79,7 @@ async function getImageMeta(current, logger, device) {
|
|
|
58
79
|
// For this case additional identification through the modelId is done.
|
|
59
80
|
// In the case of Tuya and Moes, additional identification is carried out through the manufacturerName.
|
|
60
81
|
const image = images.find((i) => i.imageType === imageType && i.manufacturerCode === manufacturerCode &&
|
|
82
|
+
(!i.minFileVersion || current.fileVersion >= i.minFileVersion) || (!i.maxFileVersion || current.fileVersion <= i.maxFileVersion) ||
|
|
61
83
|
(!i.modelId || i.modelId === modelId) && (!i.manufacturerName || i.manufacturerName.includes(manufacturerName)));
|
|
62
84
|
|
|
63
85
|
assert(image !== undefined, `No image available for imageType '${imageType}'`);
|
|
@@ -78,7 +100,7 @@ async function isUpdateAvailable(device, logger, requestPayload=null) {
|
|
|
78
100
|
}
|
|
79
101
|
|
|
80
102
|
async function updateToLatest(device, logger, onProgress) {
|
|
81
|
-
return common.updateToLatest(device, logger, onProgress, common.getNewImage, getImageMeta);
|
|
103
|
+
return common.updateToLatest(device, logger, onProgress, common.getNewImage, getImageMeta, getFirmwareFile);
|
|
82
104
|
}
|
|
83
105
|
|
|
84
106
|
module.exports = {
|
|
@@ -86,6 +108,9 @@ module.exports = {
|
|
|
86
108
|
isUpdateAvailable,
|
|
87
109
|
updateToLatest,
|
|
88
110
|
useIndexOverride: (indexFileName) => {
|
|
89
|
-
|
|
111
|
+
overrideIndexFileName = indexFileName;
|
|
112
|
+
},
|
|
113
|
+
setDataDir: (dir) => {
|
|
114
|
+
dataDir = dir;
|
|
90
115
|
},
|
|
91
116
|
};
|
package/npm-shrinkwrap.json
CHANGED