matterbridge-zigbee2mqtt 2.2.2 → 2.2.3-dev.5
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 +17 -0
- package/dist/entity.d.ts +160 -12
- package/dist/entity.d.ts.map +1 -1
- package/dist/entity.js +871 -615
- package/dist/entity.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +24 -26
- package/dist/platform.js.map +1 -1
- package/dist/zigbee2mqtt.js +1 -1
- package/dist/zigbee2mqtt.js.map +1 -1
- package/dist/zigbee2mqttTypes.d.ts +4 -0
- package/dist/zigbee2mqttTypes.d.ts.map +1 -1
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
4
4
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
|
|
7
|
+
## [2.2.3] - 2024-11-XX
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- [matterbridge]: Preliminary update to support Matterbridge edge (matter.js new API).
|
|
12
|
+
- [zigbeeEntity]: Add create async to ZigbeeDevice and ZigbeeGroup.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- [package]: Updated dependencies.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
21
|
+
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
|
|
22
|
+
</a>
|
|
23
|
+
|
|
7
24
|
## [2.2.2] - 2024-11-26
|
|
8
25
|
|
|
9
26
|
### Added
|
package/dist/entity.d.ts
CHANGED
|
@@ -20,12 +20,18 @@
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License. *
|
|
22
22
|
*/
|
|
23
|
-
import { DeviceTypeDefinition, MatterbridgeDevice, ClusterId,
|
|
23
|
+
import { DeviceTypeDefinition, MatterbridgeDevice, ClusterId, BridgedDeviceBasicInformation, Endpoint, EndpointOptions, ClusterServerObj, ClusterClientObj, Semtag, AtLeastOne } from 'matterbridge';
|
|
24
24
|
import { AnsiLogger } from 'matterbridge/logger';
|
|
25
25
|
import EventEmitter from 'events';
|
|
26
26
|
import { ZigbeePlatform } from './platform.js';
|
|
27
27
|
import { BridgeDevice, BridgeGroup } from './zigbee2mqttTypes.js';
|
|
28
28
|
import { Payload, PayloadValue } from './payloadTypes.js';
|
|
29
|
+
/**
|
|
30
|
+
* Represents a Zigbee entity: a group or a device.
|
|
31
|
+
*
|
|
32
|
+
* @class
|
|
33
|
+
* @extends {EventEmitter}
|
|
34
|
+
*/
|
|
29
35
|
export declare class ZigbeeEntity extends EventEmitter {
|
|
30
36
|
log: AnsiLogger;
|
|
31
37
|
serial: string;
|
|
@@ -52,32 +58,150 @@ export declare class ZigbeeEntity extends EventEmitter {
|
|
|
52
58
|
value_min?: number;
|
|
53
59
|
value_max?: number;
|
|
54
60
|
unit?: string;
|
|
61
|
+
category?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
label?: string;
|
|
55
64
|
action?: string;
|
|
56
65
|
}>;
|
|
66
|
+
protected readonly mutableDevice: Map<string, {
|
|
67
|
+
tagList: Semtag[];
|
|
68
|
+
deviceTypes: DeviceTypeDefinition[];
|
|
69
|
+
clusterServersIds: ClusterId[];
|
|
70
|
+
clusterServersObjs: ClusterServerObj[];
|
|
71
|
+
clusterClientsIds: ClusterId[];
|
|
72
|
+
clusterClientsObjs: ClusterClientObj[];
|
|
73
|
+
}>;
|
|
57
74
|
colorTimeout: NodeJS.Timeout | undefined;
|
|
58
75
|
thermostatTimeout: NodeJS.Timeout | undefined;
|
|
76
|
+
protected composedType: string;
|
|
59
77
|
protected hasEndpoints: boolean;
|
|
60
78
|
isRouter: boolean;
|
|
61
79
|
protected noUpdate: boolean;
|
|
62
|
-
createDevice(definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, includeServerList?: ClusterId[], options?: EndpointOptions, debug?: boolean): MatterbridgeDevice;
|
|
63
|
-
configure(): void;
|
|
64
80
|
/**
|
|
65
|
-
*
|
|
81
|
+
* Creates an instance of ZigbeeEntity.
|
|
66
82
|
*
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {Record<string, any>} payload - The payload of the event to trigger.
|
|
70
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
71
|
-
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
83
|
+
* @param {ZigbeePlatform} platform - The Zigbee platform instance.
|
|
84
|
+
* @param {BridgeDevice | BridgeGroup} entity - The bridge device or group instance received from zigbee2mqtt.
|
|
72
85
|
*/
|
|
73
|
-
triggerEvent(clusterId: ClusterId, event: string, payload: Record<string, any>, log?: AnsiLogger, endpoint?: Endpoint): void;
|
|
74
86
|
constructor(platform: ZigbeePlatform, entity: BridgeDevice | BridgeGroup);
|
|
87
|
+
/**
|
|
88
|
+
* Destroys the ZigbeeEntity instance by clearing any active timeouts.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* This method is used to clean up the ZigbeeEntity instance by clearing any active timeouts for color and thermostat operations.
|
|
92
|
+
* It ensures that no further actions are taken on these timeouts after the entity is destroyed.
|
|
93
|
+
*/
|
|
75
94
|
destroy(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a mutable device with the specified definition and includes the specified server list.
|
|
97
|
+
*
|
|
98
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device type definition.
|
|
99
|
+
* @param {ClusterId[]} [includeServerList=[]] - The list of server clusters to include.
|
|
100
|
+
* @param {EndpointOptions} [options] - Optional endpoint options.
|
|
101
|
+
* @param {boolean} [debug] - Optional debug flag.
|
|
102
|
+
* @returns {MatterbridgeDevice} The created mutable device.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* This method creates a mutable device based on the provided definition. It adds the specified server clusters
|
|
106
|
+
* to the device and configures the device with basic information and power source clusters. If the device is a
|
|
107
|
+
* coordinator, it sets up the basic information cluster with coordinator-specific details. If the device is a
|
|
108
|
+
* group, it sets up the basic information cluster with group-specific details. The method also configures the
|
|
109
|
+
* power source cluster based on the device's power source.
|
|
110
|
+
*/
|
|
111
|
+
protected createMutableDevice(definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, options?: EndpointOptions, debug?: boolean): Promise<MatterbridgeDevice>;
|
|
112
|
+
protected getBridgedDeviceBasicInformation(): ClusterServerObj<BridgedDeviceBasicInformation.Cluster>;
|
|
113
|
+
protected addBridgedDeviceBasicInformation(): MatterbridgeDevice;
|
|
114
|
+
protected getPowerSource(): ClusterServerObj<any>;
|
|
115
|
+
protected addPowerSource(): MatterbridgeDevice;
|
|
116
|
+
/**
|
|
117
|
+
* Verifies that all required server clusters are present on the main endpoint and child endpoints.
|
|
118
|
+
*
|
|
119
|
+
* @param {MatterbridgeDevice} endpoint - The device endpoint to verify.
|
|
120
|
+
* @returns {boolean} True if all required server clusters are present, false otherwise.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* This method checks if all required server clusters are present on the main endpoint and its child endpoints.
|
|
124
|
+
* It logs an error message if any required server cluster is missing and returns false. If all required server
|
|
125
|
+
* clusters are present, it returns true.
|
|
126
|
+
*/
|
|
127
|
+
protected verifyMutableDevice(endpoint: MatterbridgeDevice): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Configures the device by setting up the WindowCovering and DoorLock clusters if they are present.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Promise<void>} A promise that resolves when the configuration is complete.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* This method configures the device by checking for the presence of the WindowCovering and DoorLock clusters.
|
|
135
|
+
* If the WindowCovering cluster is present, it sets the target as the current position and stops any ongoing
|
|
136
|
+
* movement. If the DoorLock cluster is present, it retrieves the lock state and triggers the appropriate lock
|
|
137
|
+
* operation event based on the current state.
|
|
138
|
+
*/
|
|
139
|
+
configure(): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Updates the attribute of a cluster on a device endpoint if the value has changed.
|
|
142
|
+
*
|
|
143
|
+
* @param {Endpoint} deviceEndpoint - The device endpoint to update.
|
|
144
|
+
* @param {string | undefined} childEndpointName - The name of the child endpoint, if any.
|
|
145
|
+
* @param {number} clusterId - The ID of the cluster to update.
|
|
146
|
+
* @param {string} attributeName - The name of the attribute to update.
|
|
147
|
+
* @param {PayloadValue} value - The new value of the attribute.
|
|
148
|
+
* @param {string[]} [lookup] - Optional lookup array for converting string values to indices.
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* This method checks if the specified attribute of a cluster on a device endpoint has changed. If the attribute
|
|
152
|
+
* has changed, it updates the attribute with the new value. If a lookup array is provided, it converts string
|
|
153
|
+
* values to their corresponding indices in the lookup array. The method logs the update process and handles any
|
|
154
|
+
* errors that occur during the update.
|
|
155
|
+
*/
|
|
76
156
|
protected updateAttributeIfChanged(deviceEndpoint: Endpoint, childEndpointName: string | undefined, clusterId: number, attributeName: string, value: PayloadValue, lookup?: string[]): void;
|
|
157
|
+
/**
|
|
158
|
+
* Publishes a command to the specified entity with the given payload.
|
|
159
|
+
*
|
|
160
|
+
* @param {string} command - The command to execute.
|
|
161
|
+
* @param {string} entityName - The name of the entity to publish the command to.
|
|
162
|
+
* @param {Payload} payload - The payload of the command.
|
|
163
|
+
*
|
|
164
|
+
* @remarks
|
|
165
|
+
* This method logs the execution of the command and publishes the command to the specified entity.
|
|
166
|
+
* If the entity name starts with 'bridge/request', it publishes the payload without a 'set' suffix.
|
|
167
|
+
* Otherwise, it publishes the payload with a 'set' suffix.
|
|
168
|
+
*/
|
|
77
169
|
protected publishCommand(command: string, entityName: string, payload: Payload): void;
|
|
170
|
+
/**
|
|
171
|
+
* Logs the property map of the Zigbee entity.
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* This method iterates over the property map of the Zigbee entity and logs each property's details,
|
|
175
|
+
* including its name, type, values, minimum and maximum values, unit, and endpoint.
|
|
176
|
+
*/
|
|
177
|
+
protected logPropertyMap(): void;
|
|
78
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Represents a Zigbee group entity.
|
|
181
|
+
*
|
|
182
|
+
* @class
|
|
183
|
+
* @extends {ZigbeeEntity}
|
|
184
|
+
*/
|
|
79
185
|
export declare class ZigbeeGroup extends ZigbeeEntity {
|
|
80
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Creates an instance of ZigbeeGroup.
|
|
188
|
+
*
|
|
189
|
+
* @param {ZigbeePlatform} platform - The Zigbee platform instance.
|
|
190
|
+
* @param {BridgeGroup} group - The bridge group instance.
|
|
191
|
+
*/
|
|
192
|
+
private constructor();
|
|
193
|
+
/**
|
|
194
|
+
* Creates a new ZigbeeGroup instance.
|
|
195
|
+
*
|
|
196
|
+
* @param {ZigbeePlatform} platform - The Zigbee platform instance.
|
|
197
|
+
* @param {BridgeGroup} group - The bridge group instance.
|
|
198
|
+
* @returns {Promise<ZigbeeGroup>} A promise that resolves to the created ZigbeeGroup instance.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* This method initializes a new ZigbeeGroup instance, sets up its properties, and configures the device
|
|
202
|
+
* based on the group members. It also adds command handlers for the group.
|
|
203
|
+
*/
|
|
204
|
+
static create(platform: ZigbeePlatform, group: BridgeGroup): Promise<ZigbeeGroup>;
|
|
81
205
|
}
|
|
82
206
|
export interface ZigbeeToMatter {
|
|
83
207
|
type: string;
|
|
@@ -90,7 +214,31 @@ export interface ZigbeeToMatter {
|
|
|
90
214
|
valueLookup?: string[];
|
|
91
215
|
}
|
|
92
216
|
export declare const z2ms: ZigbeeToMatter[];
|
|
217
|
+
/**
|
|
218
|
+
* Represents a Zigbee device entity.
|
|
219
|
+
*
|
|
220
|
+
* @class
|
|
221
|
+
* @extends {ZigbeeEntity}
|
|
222
|
+
*/
|
|
93
223
|
export declare class ZigbeeDevice extends ZigbeeEntity {
|
|
94
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Represents a Zigbee device entity.
|
|
226
|
+
*
|
|
227
|
+
* @class
|
|
228
|
+
* @extends {ZigbeeEntity}
|
|
229
|
+
*/
|
|
230
|
+
private constructor();
|
|
231
|
+
/**
|
|
232
|
+
* Creates a new ZigbeeDevice instance.
|
|
233
|
+
*
|
|
234
|
+
* @param {ZigbeePlatform} platform - The Zigbee platform instance.
|
|
235
|
+
* @param {BridgeDevice} device - The bridge device instance.
|
|
236
|
+
* @returns {Promise<ZigbeeDevice>} A promise that resolves to the created ZigbeeDevice instance.
|
|
237
|
+
*
|
|
238
|
+
* @remarks
|
|
239
|
+
* This method initializes a new ZigbeeDevice instance, sets up its properties, and configures the device
|
|
240
|
+
* based on the device definition and options. It also adds command handlers for the device.
|
|
241
|
+
*/
|
|
242
|
+
static create(platform: ZigbeePlatform, device: BridgeDevice): Promise<ZigbeeDevice>;
|
|
95
243
|
}
|
|
96
244
|
//# sourceMappingURL=entity.d.ts.map
|
package/dist/entity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAgBlB,SAAS,EAGT,6BAA6B,EAG7B,QAAQ,EAmBR,eAAe,EAOf,gBAAgB,EAChB,gBAAgB,EAchB,MAAM,EACN,UAAU,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAyG,MAAM,qBAAqB,CAAC;AAIxJ,OAAO,YAAY,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