zigbee-herdsman-converters 14.0.388 → 14.0.389
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 +13 -0
- package/lib/ota/common.js +11 -2
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/converters/fromZigbee.js
CHANGED
|
@@ -4362,6 +4362,14 @@ const converters = {
|
|
|
4362
4362
|
convert: (model, msg, publis, options, meta) => {
|
|
4363
4363
|
// Don't use in production!
|
|
4364
4364
|
// Used in: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_tuya_devices.html
|
|
4365
|
+
const getType = (datatype) => {
|
|
4366
|
+
const entry = Object.entries(tuya.dataTypes).find(([typeName, typeId]) => typeId === datatype);
|
|
4367
|
+
return (entry ? entry[0] : 'unknown');
|
|
4368
|
+
};
|
|
4369
|
+
const getAllDpIds = (dp) => {
|
|
4370
|
+
const entries = Object.entries(tuya.dataPoints).filter(([dpName, dpId]) => dpId === dp);
|
|
4371
|
+
return entries.map(([dpName, dpId]) => dpName);
|
|
4372
|
+
};
|
|
4365
4373
|
const getHex = (value) => {
|
|
4366
4374
|
let hex = value.toString(16);
|
|
4367
4375
|
if (hex.length < 2) {
|
|
@@ -4372,6 +4380,11 @@ const converters = {
|
|
|
4372
4380
|
const now = Date.now().toString();
|
|
4373
4381
|
let dataStr = '';
|
|
4374
4382
|
for (const [i, dpValue] of msg.data.dpValues.entries()) {
|
|
4383
|
+
const value = tuya.getDataValue(dpValue);
|
|
4384
|
+
meta.logger.info(`zigbee-herdsman-converters:tuya_data_point_dump: Received DP #${
|
|
4385
|
+
dpValue.dp} from ${meta.device.ieeeAddr} with raw data '${JSON.stringify(dpValue)}': type='${msg.type}', datatype='${
|
|
4386
|
+
getType(dpValue.datatype)}', value='${value}', known DP# usage: ${JSON.stringify(getAllDpIds(dpValue.dp))}`);
|
|
4387
|
+
|
|
4375
4388
|
dataStr +=
|
|
4376
4389
|
now + ' ' +
|
|
4377
4390
|
meta.device.ieeeAddr + ' ' +
|
package/lib/ota/common.js
CHANGED
|
@@ -385,9 +385,18 @@ async function updateToLatest(device, logger, onProgress, getNewImage, getImageM
|
|
|
385
385
|
|
|
386
386
|
endpoint.commandResponse('genOta', 'upgradeEndResponse', payload).then(
|
|
387
387
|
() => {
|
|
388
|
-
logger.debug(`Update succeeded`);
|
|
388
|
+
logger.debug(`Update succeeded, waiting for device announce`);
|
|
389
389
|
onProgress(100, null);
|
|
390
|
-
|
|
390
|
+
|
|
391
|
+
let timer = null;
|
|
392
|
+
const cb = () => {
|
|
393
|
+
logger.debug('Got device announce or timed out, call resolve');
|
|
394
|
+
clearInterval(timer);
|
|
395
|
+
device.removeListener('deviceAnnounce', cb);
|
|
396
|
+
resolve();
|
|
397
|
+
};
|
|
398
|
+
timer = setTimeout(cb, 120 * 1000); // timeout after 2 minutes
|
|
399
|
+
device.once('deviceAnnounce', cb);
|
|
391
400
|
},
|
|
392
401
|
(e) => {
|
|
393
402
|
const message = `Upgrade end reponse failed (${e.message})`;
|
package/npm-shrinkwrap.json
CHANGED