mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-29 23:28:34 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ed29d045b | ||
|
|
75acffa8c7 | ||
|
|
ade84dc6c0 | ||
|
|
7d49e136a6 | ||
|
|
0c1dba7208 |
+3
-4
@@ -10,8 +10,7 @@ const objectAssignDeep = require(`object-assign-deep`);
|
||||
|
||||
const mqttConfigRegex = new RegExp(`${settings.get().mqtt.base_topic}/bridge/config/\\w+`, 'g');
|
||||
const mqttDeviceRegex = new RegExp(`${settings.get().mqtt.base_topic}/[\\w\\s\\d.-]+/set`, 'g');
|
||||
const mqttDevicePrefixRegex = new RegExp(`${settings.get().mqtt.base_topic}/[\\w\\s\\d.-]
|
||||
+/[\\w\\s\\d.-]+/set`, 'g');
|
||||
const mqttDevicePrefixRegex = new RegExp(`${settings.get().mqtt.base_topic}/[\\w\\s\\d.-]+/[\\w\\s\\d.-]+/set`, 'g');
|
||||
|
||||
const pollInterval = 60 * 1000; // seconds * 1000.
|
||||
const softResetTimeout = 3600 * 1000; // seconds * 1000.
|
||||
@@ -479,8 +478,8 @@ class Controller {
|
||||
}
|
||||
|
||||
handleMQTTMessageDevice(topic, message, withPrefix) {
|
||||
const friendlyName = topic.split('/').slice(-2)[0];
|
||||
const topicPrefix = withPrefix ? topic.split('/').slice(-3)[0] : '';
|
||||
const friendlyName = topic.split('/').slice(withPrefix ? -3 : -2)[0];
|
||||
const topicPrefix = withPrefix ? topic.split('/').slice(-2)[0] : '';
|
||||
|
||||
// Map friendlyName to deviceID.
|
||||
const deviceID = settings.getIDByFriendlyName(friendlyName);
|
||||
|
||||
+10
-2
@@ -192,7 +192,7 @@ class Zigbee {
|
||||
|
||||
logger.info(`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep}`);
|
||||
|
||||
device[type](cid, cmd, [zclData], (error) => {
|
||||
const callback_ = (error) => {
|
||||
if (error) {
|
||||
logger.error(
|
||||
`Zigbee publish to '${deviceID}', ${cid} - ${cmd} - ${JSON.stringify(zclData)} - ${ep} ` +
|
||||
@@ -200,7 +200,15 @@ class Zigbee {
|
||||
}
|
||||
|
||||
callback(error);
|
||||
});
|
||||
};
|
||||
|
||||
if (type === 'functional') {
|
||||
device.functional(cid, cmd, zclData, callback_);
|
||||
} else if (type === 'foundation') {
|
||||
device.foundation(cid, cmd, [zclData], callback_);
|
||||
} else {
|
||||
logger.error(`Unknown zigbee publish type ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
read(deviceID, cid, attr, ep, callback) {
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zigbee2mqtt",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zigbee2mqtt",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.6",
|
||||
"description": "Zigbee to MQTT bridge using zigbee-shepherd",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user