matterbridge-zigbee2mqtt 2.4.4-dev.1 → 2.4.4-dev.2
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/CHANGELOG.md +1 -1
- package/dist/entity.js +8 -3
- package/dist/platform.js +8 -7
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/entity.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { airQualitySensor, colorTemperatureSwitch, dimmableSwitch, onOffSwitch,
|
|
1
|
+
import { airQualitySensor, colorTemperatureSwitch, dimmableSwitch, onOffSwitch, powerSource, bridgedNode, electricalSensor, onOffLight, dimmableLight, colorTemperatureLight, onOffOutlet, coverDevice, thermostatDevice, MatterbridgeEndpoint, dimmableOutlet, doorLockDevice, occupancySensor, lightSensor, contactSensor, temperatureSensor, humiditySensor, pressureSensor, genericSwitch, } from 'matterbridge';
|
|
2
2
|
import { AnsiLogger, gn, dn, ign, idn, rs, db, debugStringify, hk, zb, or, nf, CYAN, er, YELLOW } from 'matterbridge/logger';
|
|
3
3
|
import { deepCopy, deepEqual, isValidNumber } from 'matterbridge/utils';
|
|
4
|
-
import { PowerSourceBehavior } from 'matterbridge/matter';
|
|
5
4
|
import * as color from 'matterbridge/utils';
|
|
5
|
+
import { SwitchesTag, NumberTag } from 'matterbridge/matter';
|
|
6
|
+
import { getClusterNameById, ClusterId } from 'matterbridge/matter/types';
|
|
7
|
+
import { ElectricalEnergyMeasurement, ElectricalPowerMeasurement, OnOffCluster, LevelControlCluster, WindowCoveringCluster, DoorLockCluster, BridgedDeviceBasicInformation, OnOff, LevelControl, ColorControl, ColorControlCluster, TemperatureMeasurement, BooleanState, RelativeHumidityMeasurement, PressureMeasurement, OccupancySensing, IlluminanceMeasurement, PowerSource, WindowCovering, DoorLock, ThermostatCluster, Thermostat, AirQuality, TotalVolatileOrganicCompoundsConcentrationMeasurement, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, FormaldehydeConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm25ConcentrationMeasurement, Pm10ConcentrationMeasurement, } from 'matterbridge/matter/clusters';
|
|
8
|
+
import { PowerSourceBehavior } from 'matterbridge/matter/behaviors';
|
|
6
9
|
import EventEmitter from 'events';
|
|
7
10
|
import { hostname } from 'os';
|
|
8
11
|
function require(type, options) {
|
|
@@ -257,6 +260,8 @@ export class ZigbeeEntity extends EventEmitter {
|
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
updateAttributeIfChanged(deviceEndpoint, childEndpointName, clusterId, attributeName, value, lookup) {
|
|
263
|
+
if (value === undefined)
|
|
264
|
+
return;
|
|
260
265
|
if (childEndpointName && childEndpointName !== '') {
|
|
261
266
|
deviceEndpoint = this.bridgedDevice?.getChildEndpointByName(childEndpointName) ?? deviceEndpoint;
|
|
262
267
|
}
|
|
@@ -287,7 +292,7 @@ export class ZigbeeEntity extends EventEmitter {
|
|
|
287
292
|
this.log.info(`${db}Update endpoint ${this.eidn}${deviceEndpoint.name}:${deviceEndpoint.number}${db}${childEndpointName ? ' (' + zb + childEndpointName + db + ')' : ''} ` +
|
|
288
293
|
`attribute ${hk}${getClusterNameById(ClusterId(clusterId))}${db}.${hk}${attributeName}${db} from ${YELLOW}${typeof localValue === 'object' ? debugStringify(localValue) : localValue}${db} to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
289
294
|
try {
|
|
290
|
-
deviceEndpoint.setAttribute(ClusterId(clusterId), attributeName, value
|
|
295
|
+
deviceEndpoint.setAttribute(ClusterId(clusterId), attributeName, value);
|
|
291
296
|
}
|
|
292
297
|
catch (error) {
|
|
293
298
|
this.log.error(`Error setting attribute ${hk}${getClusterNameById(ClusterId(clusterId))}${er}.${hk}${attributeName}${er} to ${value}: ${error}`);
|
package/dist/platform.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MatterbridgeDynamicPlatform } from 'matterbridge';
|
|
2
2
|
import { dn, gn, db, wr, zb, payloadStringify, rs, debugStringify, CYAN, er, nf } from 'matterbridge/logger';
|
|
3
3
|
import { isValidNumber, isValidString, waiter } from 'matterbridge/utils';
|
|
4
|
+
import { BridgedDeviceBasicInformation, DoorLock } from 'matterbridge/matter/clusters';
|
|
4
5
|
import path from 'path';
|
|
5
6
|
import { ZigbeeDevice, ZigbeeGroup } from './entity.js';
|
|
6
7
|
import { Zigbee2MQTT } from './zigbee2mqtt.js';
|
|
@@ -192,12 +193,12 @@ export class ZigbeePlatform extends MatterbridgeDynamicPlatform {
|
|
|
192
193
|
if (zigbeeEntity.isRouter && (device === undefined || device === zigbeeEntity.bridgedDevice?.deviceName)) {
|
|
193
194
|
this.log.info(`*- ${zigbeeEntity.bridgedDevice?.deviceName} ${zigbeeEntity.bridgedDevice?.number} (${zigbeeEntity.bridgedDevice?.name})`);
|
|
194
195
|
if (zigbeeEntity.device && status) {
|
|
195
|
-
zigbeeEntity.bridgedDevice?.setAttribute(
|
|
196
|
+
zigbeeEntity.bridgedDevice?.setAttribute(DoorLock.Cluster.id, 'lockState', DoorLock.LockState.Unlocked, this.log);
|
|
196
197
|
zigbeeEntity.bridgedDevice?.triggerEvent(DoorLock.Cluster.id, 'lockOperation', { lockOperationType: DoorLock.LockOperationType.Unlock, operationSource: DoorLock.OperationSource.Manual, userIndex: null, fabricIndex: null, sourceNode: null }, this.log);
|
|
197
198
|
this.log.info(`Device ${zigbeeEntity.entityName} unlocked`);
|
|
198
199
|
}
|
|
199
200
|
if (zigbeeEntity.device && !status) {
|
|
200
|
-
zigbeeEntity.bridgedDevice?.setAttribute(
|
|
201
|
+
zigbeeEntity.bridgedDevice?.setAttribute(DoorLock.Cluster.id, 'lockState', DoorLock.LockState.Locked, this.log);
|
|
201
202
|
zigbeeEntity.bridgedDevice?.triggerEvent(DoorLock.Cluster.id, 'lockOperation', { lockOperationType: DoorLock.LockOperationType.Lock, operationSource: DoorLock.OperationSource.Manual, userIndex: null, fabricIndex: null, sourceNode: null }, this.log);
|
|
202
203
|
this.log.info(`Device ${zigbeeEntity.entityName} locked`);
|
|
203
204
|
}
|
|
@@ -325,14 +326,14 @@ export class ZigbeePlatform extends MatterbridgeDynamicPlatform {
|
|
|
325
326
|
if (bridgedEntity.isRouter && bridgedEntity.bridgedDevice) {
|
|
326
327
|
this.log.info(`Configuring router ${bridgedEntity.bridgedDevice?.deviceName}.`);
|
|
327
328
|
if (this.z2mBridgeInfo?.permit_join) {
|
|
328
|
-
bridgedEntity.bridgedDevice?.setAttribute(
|
|
329
|
+
bridgedEntity.bridgedDevice?.setAttribute(DoorLock.Cluster.id, 'lockState', DoorLock.LockState.Unlocked, this.log);
|
|
329
330
|
if (bridgedEntity.bridgedDevice.number)
|
|
330
|
-
bridgedEntity.bridgedDevice?.triggerEvent(
|
|
331
|
+
bridgedEntity.bridgedDevice?.triggerEvent(DoorLock.Cluster.id, 'lockOperation', { lockOperationType: DoorLock.LockOperationType.Unlock, operationSource: DoorLock.OperationSource.Manual, userIndex: null, fabricIndex: null, sourceNode: null }, this.log);
|
|
331
332
|
}
|
|
332
333
|
else {
|
|
333
|
-
bridgedEntity.bridgedDevice?.setAttribute(
|
|
334
|
+
bridgedEntity.bridgedDevice?.setAttribute(DoorLock.Cluster.id, 'lockState', DoorLock.LockState.Locked, this.log);
|
|
334
335
|
if (bridgedEntity.bridgedDevice.number)
|
|
335
|
-
bridgedEntity.bridgedDevice?.triggerEvent(
|
|
336
|
+
bridgedEntity.bridgedDevice?.triggerEvent(DoorLock.Cluster.id, 'lockOperation', { lockOperationType: DoorLock.LockOperationType.Lock, operationSource: DoorLock.OperationSource.Manual, userIndex: null, fabricIndex: null, sourceNode: null }, this.log);
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge-zigbee2mqtt",
|
|
3
|
-
"version": "2.4.4-dev.
|
|
3
|
+
"version": "2.4.4-dev.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge-zigbee2mqtt",
|
|
9
|
-
"version": "2.4.4-dev.
|
|
9
|
+
"version": "2.4.4-dev.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"moment": "2.30.1",
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
"license": "MIT"
|
|
96
96
|
},
|
|
97
97
|
"node_modules/bl": {
|
|
98
|
-
"version": "6.0.
|
|
99
|
-
"resolved": "https://registry.npmjs.org/bl/-/bl-6.0.
|
|
100
|
-
"integrity": "sha512-
|
|
98
|
+
"version": "6.0.19",
|
|
99
|
+
"resolved": "https://registry.npmjs.org/bl/-/bl-6.0.19.tgz",
|
|
100
|
+
"integrity": "sha512-4Ay3A3oDfGg3GGirhl4s62ebtnk0pJZA5mLp672MPKOQXsWvXjEF4dqdXySjJIs7b9OVr/O8aOo0Lm+xdjo2JA==",
|
|
101
101
|
"license": "MIT",
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@types/readable-stream": "^4.0.0",
|