matterbridge 2.2.7 → 3.0.0-edge.1
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 +43 -0
- package/README-DEV.md +24 -12
- package/dist/cli.js +2 -37
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/frontend.js +19 -325
- package/dist/index.js +1 -28
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +89 -760
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +15 -41
- package/dist/matterbridgeDeviceTypes.js +151 -228
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEndpoint.js +87 -732
- package/dist/matterbridgeEndpointHelpers.js +30 -136
- package/dist/matterbridgePlatform.js +7 -216
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +36 -305
- package/dist/shelly.js +6 -146
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -45
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -40
- package/dist/utils/deepEqual.js +1 -65
- package/dist/utils/export.js +0 -1
- package/dist/utils/isvalid.js +0 -86
- package/dist/utils/network.js +5 -76
- package/dist/utils/parameter.js +0 -41
- package/dist/utils/wait.js +5 -48
- package/npm-shrinkwrap.json +44 -44
- package/package.json +2 -3
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/frontend.d.ts +0 -221
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -425
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1056
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -177
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -852
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2275
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -285
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -183
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -271
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -92
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -32
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -10
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -87
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/parameter.d.ts +0 -44
- package/dist/utils/parameter.d.ts.map +0 -1
- package/dist/utils/parameter.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -43
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
// AnsiLogger module
|
|
24
1
|
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
|
|
25
|
-
// Matterbridge
|
|
26
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
27
3
|
import { isValidNumber, isValidObject } from './utils/export.js';
|
|
28
4
|
import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
|
|
29
5
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
30
|
-
// @matter
|
|
31
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
|
|
32
7
|
import { ClusterType, getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
-
// @matter clusters
|
|
34
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
35
9
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
36
10
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -52,7 +26,9 @@ import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-pow
|
|
|
52
26
|
import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-energy-measurement';
|
|
53
27
|
import { AirQuality } from '@matter/main/clusters/air-quality';
|
|
54
28
|
import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
|
|
55
|
-
|
|
29
|
+
import { RvcRunMode } from '@matter/main/clusters/rvc-run-mode';
|
|
30
|
+
import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
|
|
31
|
+
import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
|
|
56
32
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
57
33
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
58
34
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -81,9 +57,12 @@ import { Pm25ConcentrationMeasurementServer } from '@matter/main/behaviors/pm25-
|
|
|
81
57
|
import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-concentration-measurement';
|
|
82
58
|
import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
|
|
83
59
|
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
60
|
+
import { RvcRunModeServer } from '@matter/main/behaviors/rvc-run-mode';
|
|
61
|
+
import { RvcOperationalStateServer } from '@matter/main/behaviors/rvc-operational-state';
|
|
62
|
+
import { RvcCleanModeServer } from '@matter/main/behaviors/rvc-clean-mode';
|
|
84
63
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
85
64
|
static bridgeMode = '';
|
|
86
|
-
static logLevel = "info"
|
|
65
|
+
static logLevel = "info";
|
|
87
66
|
log;
|
|
88
67
|
plugin = undefined;
|
|
89
68
|
configUrl = undefined;
|
|
@@ -99,25 +78,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
99
78
|
hardwareVersion = undefined;
|
|
100
79
|
hardwareVersionString = undefined;
|
|
101
80
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
102
|
-
// The first device type of the endpoint
|
|
103
81
|
name = undefined;
|
|
104
82
|
deviceType;
|
|
105
83
|
uniqueStorageKey = undefined;
|
|
106
84
|
tagList = undefined;
|
|
107
|
-
// Maps matter deviceTypes
|
|
108
85
|
deviceTypes = new Map();
|
|
109
|
-
// Command handler
|
|
110
86
|
commandHandler = new NamedHandler();
|
|
111
|
-
/**
|
|
112
|
-
* Represents a MatterbridgeEndpoint.
|
|
113
|
-
* @constructor
|
|
114
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
115
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
116
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
117
|
-
*/
|
|
118
87
|
constructor(definition, options = {}, debug = false) {
|
|
119
88
|
let deviceTypeList = [];
|
|
120
|
-
// Get the first DeviceTypeDefinition
|
|
121
89
|
let firstDefinition;
|
|
122
90
|
if (Array.isArray(definition)) {
|
|
123
91
|
firstDefinition = definition[0];
|
|
@@ -130,7 +98,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
130
98
|
firstDefinition = definition;
|
|
131
99
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
132
100
|
}
|
|
133
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
134
101
|
const deviceTypeDefinitionV8 = {
|
|
135
102
|
name: firstDefinition.name.replace('-', '_'),
|
|
136
103
|
deviceType: firstDefinition.code,
|
|
@@ -149,11 +116,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
149
116
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
150
117
|
};
|
|
151
118
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
152
|
-
// Check if the uniqueStorageKey is valid
|
|
153
119
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
154
120
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
155
121
|
}
|
|
156
|
-
// Convert the options to an Endpoint.Options
|
|
157
122
|
const optionsV8 = {
|
|
158
123
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
159
124
|
number: options.endpointId,
|
|
@@ -171,41 +136,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
171
136
|
}
|
|
172
137
|
else
|
|
173
138
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
174
|
-
|
|
175
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
176
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
177
|
-
// Create the logger
|
|
178
|
-
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
139
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
179
140
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
180
141
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
181
|
-
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
182
142
|
this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
|
|
183
143
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
186
|
-
*
|
|
187
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
188
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
189
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
190
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
191
|
-
*/
|
|
192
144
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
193
145
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
194
146
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Get all the device types of this endpoint.
|
|
197
|
-
*
|
|
198
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
199
|
-
*/
|
|
200
147
|
getDeviceTypes() {
|
|
201
148
|
return Array.from(this.deviceTypes.values());
|
|
202
149
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
205
|
-
*
|
|
206
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
207
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
208
|
-
*/
|
|
209
150
|
hasClusterServer(cluster) {
|
|
210
151
|
const behavior = getBehavior(this, cluster);
|
|
211
152
|
if (behavior)
|
|
@@ -213,13 +154,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
213
154
|
else
|
|
214
155
|
return false;
|
|
215
156
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
218
|
-
*
|
|
219
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
220
|
-
* @param {string} attribute - The attribute name to check.
|
|
221
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
222
|
-
*/
|
|
223
157
|
hasAttributeServer(cluster, attribute) {
|
|
224
158
|
const behavior = getBehavior(this, cluster);
|
|
225
159
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -228,186 +162,72 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
228
162
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
229
163
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
230
164
|
}
|
|
231
|
-
/**
|
|
232
|
-
* Retrieves the initial options for the provided cluster server.
|
|
233
|
-
*
|
|
234
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
235
|
-
* @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
|
|
236
|
-
*/
|
|
237
165
|
getClusterServerOptions(cluster) {
|
|
238
166
|
const behavior = getBehavior(this, cluster);
|
|
239
167
|
if (!behavior)
|
|
240
168
|
return undefined;
|
|
241
169
|
return this.behaviors.optionsFor(behavior);
|
|
242
170
|
}
|
|
243
|
-
/**
|
|
244
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
245
|
-
*
|
|
246
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
247
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
248
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
249
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
250
|
-
*/
|
|
251
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
252
171
|
getAttribute(cluster, attribute, log) {
|
|
253
172
|
return getAttribute(this, cluster, attribute, log);
|
|
254
173
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Sets the value of an attribute on a cluster server.
|
|
257
|
-
*
|
|
258
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
259
|
-
* @param {string} attribute - The name of the attribute.
|
|
260
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
261
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
262
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
263
|
-
*/
|
|
264
174
|
async setAttribute(clusterId, attribute, value, log) {
|
|
265
175
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
266
176
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
269
|
-
*
|
|
270
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
271
|
-
* @param {string} attribute - The name of the attribute.
|
|
272
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
273
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
274
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
275
|
-
*/
|
|
276
177
|
async updateAttribute(cluster, attribute, value, log) {
|
|
277
178
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
278
179
|
}
|
|
279
|
-
/**
|
|
280
|
-
* Subscribes to the provided attribute on a cluster.
|
|
281
|
-
*
|
|
282
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
283
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
284
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
285
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
286
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
287
|
-
*/
|
|
288
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
289
180
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
290
181
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
291
182
|
}
|
|
292
|
-
/**
|
|
293
|
-
* Triggers an event on the specified cluster.
|
|
294
|
-
*
|
|
295
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
296
|
-
* @param {string} event - The name of the event to trigger.
|
|
297
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
298
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
299
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
300
|
-
*/
|
|
301
183
|
async triggerEvent(clusterId, event, payload, log) {
|
|
302
184
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
303
185
|
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
304
186
|
this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er} is in the ${BLUE}${this.construction.status}${er} state`);
|
|
305
187
|
return false;
|
|
306
188
|
}
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
189
|
const events = this.events;
|
|
309
190
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
310
191
|
this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.id}${er}:${or}${this.number}${er}`);
|
|
311
192
|
return false;
|
|
312
193
|
}
|
|
313
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
314
|
-
// @ts-ignore
|
|
315
194
|
await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
316
195
|
log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${this.id}${db}:${or}${this.number}${db} `);
|
|
317
196
|
return true;
|
|
318
197
|
}
|
|
319
|
-
/**
|
|
320
|
-
* Adds cluster servers from the provided server list.
|
|
321
|
-
*
|
|
322
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
323
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
324
|
-
*/
|
|
325
198
|
addClusterServers(serverList) {
|
|
326
199
|
addClusterServers(this, serverList);
|
|
327
200
|
return this;
|
|
328
201
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
331
|
-
*
|
|
332
|
-
* @param {string} label - The label to add.
|
|
333
|
-
* @param {string} value - The value of the label.
|
|
334
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
335
|
-
*/
|
|
336
202
|
async addFixedLabel(label, value) {
|
|
337
203
|
await addFixedLabel(this, label, value);
|
|
338
204
|
return this;
|
|
339
205
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
342
|
-
*
|
|
343
|
-
* @param {string} label - The label to add.
|
|
344
|
-
* @param {string} value - The value of the label.
|
|
345
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
346
|
-
*/
|
|
347
206
|
async addUserLabel(label, value) {
|
|
348
207
|
await addUserLabel(this, label, value);
|
|
349
208
|
return this;
|
|
350
209
|
}
|
|
351
|
-
/**
|
|
352
|
-
* Adds a command handler for the specified command.
|
|
353
|
-
*
|
|
354
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
355
|
-
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
356
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
357
|
-
*/
|
|
358
210
|
addCommandHandler(command, handler) {
|
|
359
211
|
this.commandHandler.addHandler(command, handler);
|
|
360
212
|
return this;
|
|
361
213
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Execute the command handler for the specified command. Mainly used in Jest tests.
|
|
364
|
-
*
|
|
365
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
366
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
|
|
367
|
-
* @returns {Promise<void>} A promise that resolves when the command handler has been executed
|
|
368
|
-
*/
|
|
369
214
|
async executeCommandHandler(command, request) {
|
|
370
215
|
await this.commandHandler.executeHandler(command, { request });
|
|
371
216
|
}
|
|
372
|
-
/**
|
|
373
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
374
|
-
*
|
|
375
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
376
|
-
*/
|
|
377
217
|
addRequiredClusterServers() {
|
|
378
218
|
addRequiredClusterServers(this);
|
|
379
219
|
return this;
|
|
380
220
|
}
|
|
381
|
-
/**
|
|
382
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
383
|
-
*
|
|
384
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
385
|
-
*/
|
|
386
221
|
addOptionalClusterServers() {
|
|
387
222
|
addOptionalClusterServers(this);
|
|
388
223
|
return this;
|
|
389
224
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Retrieves all cluster servers.
|
|
392
|
-
*
|
|
393
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
394
|
-
*/
|
|
395
225
|
getAllClusterServers() {
|
|
396
226
|
return Object.values(this.behaviors.supported);
|
|
397
227
|
}
|
|
398
|
-
/**
|
|
399
|
-
* Retrieves the names of all cluster servers.
|
|
400
|
-
*
|
|
401
|
-
* @returns {string[]} An array of all cluster server names.
|
|
402
|
-
*/
|
|
403
228
|
getAllClusterServerNames() {
|
|
404
229
|
return Object.keys(this.behaviors.supported);
|
|
405
230
|
}
|
|
406
|
-
/**
|
|
407
|
-
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
408
|
-
*
|
|
409
|
-
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
410
|
-
*/
|
|
411
231
|
forEachAttribute(callback) {
|
|
412
232
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
413
233
|
return;
|
|
@@ -415,34 +235,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
415
235
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
416
236
|
const clusterId = getClusterId(this, clusterName);
|
|
417
237
|
if (clusterId === undefined) {
|
|
418
|
-
// this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
|
|
419
238
|
continue;
|
|
420
239
|
}
|
|
421
240
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
422
241
|
if (attributeId === undefined) {
|
|
423
|
-
// this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
|
|
424
242
|
continue;
|
|
425
243
|
}
|
|
426
244
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
427
245
|
}
|
|
428
246
|
}
|
|
429
247
|
}
|
|
430
|
-
/**
|
|
431
|
-
* Adds a child endpoint with the specified device types and options.
|
|
432
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
433
|
-
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
434
|
-
*
|
|
435
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
436
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
437
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
438
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
439
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
440
|
-
*
|
|
441
|
-
* @example
|
|
442
|
-
* ```typescript
|
|
443
|
-
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
444
|
-
* ```
|
|
445
|
-
*/
|
|
446
248
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
447
249
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
448
250
|
let alreadyAdded = false;
|
|
@@ -482,23 +284,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
482
284
|
}
|
|
483
285
|
return child;
|
|
484
286
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
487
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
488
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
489
|
-
*
|
|
490
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
491
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
492
|
-
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
493
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
494
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
495
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* ```typescript
|
|
499
|
-
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
500
|
-
* ```
|
|
501
|
-
*/
|
|
502
287
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
503
288
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
504
289
|
let alreadyAdded = false;
|
|
@@ -561,38 +346,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
561
346
|
}
|
|
562
347
|
return child;
|
|
563
348
|
}
|
|
564
|
-
/**
|
|
565
|
-
* Retrieves a child endpoint by its name.
|
|
566
|
-
*
|
|
567
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
568
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
569
|
-
*/
|
|
570
349
|
getChildEndpointByName(endpointName) {
|
|
571
350
|
return this.parts.find((part) => part.id === endpointName);
|
|
572
351
|
}
|
|
573
|
-
/**
|
|
574
|
-
* Retrieves a child endpoint by its EndpointNumber.
|
|
575
|
-
*
|
|
576
|
-
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
577
|
-
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
578
|
-
*/
|
|
579
352
|
getChildEndpoint(endpointNumber) {
|
|
580
353
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
581
354
|
}
|
|
582
|
-
/**
|
|
583
|
-
* Get all the child endpoints of this endpoint.
|
|
584
|
-
*
|
|
585
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
586
|
-
*/
|
|
587
355
|
getChildEndpoints() {
|
|
588
356
|
return Array.from(this.parts);
|
|
589
357
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
592
|
-
*
|
|
593
|
-
* @param pluginName - The name of the plugin.
|
|
594
|
-
* @returns The serialized Matterbridge device object.
|
|
595
|
-
*/
|
|
596
358
|
static serialize(device) {
|
|
597
359
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
598
360
|
return;
|
|
@@ -615,15 +377,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
615
377
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
616
378
|
if (behaviorName === 'powerSource')
|
|
617
379
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
618
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
619
380
|
});
|
|
620
381
|
return serialized;
|
|
621
382
|
}
|
|
622
|
-
/**
|
|
623
|
-
* Deserializes the device into a serialized object.
|
|
624
|
-
*
|
|
625
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
626
|
-
*/
|
|
627
383
|
static deserialize(serializedDevice) {
|
|
628
384
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
629
385
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -639,16 +395,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
639
395
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
640
396
|
else if (clusterId === PowerSource.Cluster.id)
|
|
641
397
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
642
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
643
398
|
}
|
|
644
399
|
return device;
|
|
645
400
|
}
|
|
646
|
-
/**
|
|
647
|
-
* Creates a default power source wired cluster server.
|
|
648
|
-
*
|
|
649
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
650
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
651
|
-
*/
|
|
652
401
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
653
402
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
654
403
|
wiredCurrentType,
|
|
@@ -659,16 +408,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
659
408
|
});
|
|
660
409
|
return this;
|
|
661
410
|
}
|
|
662
|
-
/**
|
|
663
|
-
* Creates a default power source replaceable battery cluster server.
|
|
664
|
-
*
|
|
665
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
666
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
667
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
668
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
669
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
670
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
671
|
-
*/
|
|
672
411
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
673
412
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
674
413
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -686,14 +425,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
686
425
|
});
|
|
687
426
|
return this;
|
|
688
427
|
}
|
|
689
|
-
/**
|
|
690
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
691
|
-
*
|
|
692
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
693
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
694
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
695
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
696
|
-
*/
|
|
697
428
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
698
429
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
699
430
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -712,21 +443,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
712
443
|
});
|
|
713
444
|
return this;
|
|
714
445
|
}
|
|
715
|
-
/**
|
|
716
|
-
* Creates a default Basic Information Cluster Server for the server node.
|
|
717
|
-
*
|
|
718
|
-
* @param deviceName - The name of the device.
|
|
719
|
-
* @param serialNumber - The serial number of the device.
|
|
720
|
-
* @param vendorId - The vendor ID of the device.
|
|
721
|
-
* @param vendorName - The vendor name of the device.
|
|
722
|
-
* @param productId - The product ID of the device.
|
|
723
|
-
* @param productName - The product name of the device.
|
|
724
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
725
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
726
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
727
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
728
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
729
|
-
*/
|
|
730
446
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
731
447
|
this.log.logName = deviceName;
|
|
732
448
|
this.deviceName = deviceName;
|
|
@@ -750,20 +466,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
750
466
|
}
|
|
751
467
|
return this;
|
|
752
468
|
}
|
|
753
|
-
/**
|
|
754
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
755
|
-
*
|
|
756
|
-
* @param deviceName - The name of the device.
|
|
757
|
-
* @param serialNumber - The serial number of the device.
|
|
758
|
-
* @param vendorId - The vendor ID of the device.
|
|
759
|
-
* @param vendorName - The name of the vendor.
|
|
760
|
-
* @param productName - The name of the product.
|
|
761
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
762
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
763
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
764
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
765
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
766
|
-
*/
|
|
767
469
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
768
470
|
this.log.logName = deviceName;
|
|
769
471
|
this.deviceName = deviceName;
|
|
@@ -780,7 +482,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
780
482
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
781
483
|
events: { leave: true, reachableChanged: true },
|
|
782
484
|
}), {
|
|
783
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
485
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
784
486
|
vendorName: vendorName.slice(0, 32),
|
|
785
487
|
productName: productName.slice(0, 32),
|
|
786
488
|
productUrl: this.productUrl,
|
|
@@ -796,13 +498,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
796
498
|
});
|
|
797
499
|
return this;
|
|
798
500
|
}
|
|
799
|
-
/**
|
|
800
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
801
|
-
*
|
|
802
|
-
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
803
|
-
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
804
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
805
|
-
*/
|
|
806
501
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
807
502
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
808
503
|
identifyTime,
|
|
@@ -810,32 +505,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
810
505
|
});
|
|
811
506
|
return this;
|
|
812
507
|
}
|
|
813
|
-
/**
|
|
814
|
-
* Creates a default groups cluster server.
|
|
815
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
816
|
-
*/
|
|
817
508
|
createDefaultGroupsClusterServer() {
|
|
818
509
|
this.behaviors.require(GroupsServer);
|
|
819
510
|
return this;
|
|
820
511
|
}
|
|
821
|
-
/**
|
|
822
|
-
* Creates a default scenes management cluster server.
|
|
823
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
824
|
-
*/
|
|
825
512
|
createDefaultScenesClusterServer() {
|
|
826
513
|
this.behaviors.require(ScenesManagementServer);
|
|
827
514
|
return this;
|
|
828
515
|
}
|
|
829
|
-
/**
|
|
830
|
-
* Creates a default OnOff cluster server for light devices.
|
|
831
|
-
*
|
|
832
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
833
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
834
|
-
* @param {number} [onTime=0] - The on time value.
|
|
835
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
836
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
837
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
838
|
-
*/
|
|
839
516
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
840
517
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
841
518
|
onOff,
|
|
@@ -846,40 +523,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
846
523
|
});
|
|
847
524
|
return this;
|
|
848
525
|
}
|
|
849
|
-
/**
|
|
850
|
-
* Creates an OnOff cluster server without features.
|
|
851
|
-
*
|
|
852
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
853
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
854
|
-
*/
|
|
855
526
|
createOnOffClusterServer(onOff = false) {
|
|
856
527
|
this.behaviors.require(MatterbridgeOnOffServer.for(ClusterType(OnOff.Base)), {
|
|
857
528
|
onOff,
|
|
858
529
|
});
|
|
859
530
|
return this;
|
|
860
531
|
}
|
|
861
|
-
/**
|
|
862
|
-
* Creates a DeadFront OnOff cluster server.
|
|
863
|
-
*
|
|
864
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
865
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
866
|
-
*/
|
|
867
532
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
868
533
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
869
534
|
onOff,
|
|
870
535
|
});
|
|
871
536
|
return this;
|
|
872
537
|
}
|
|
873
|
-
/**
|
|
874
|
-
* Creates a default level control cluster server for light devices.
|
|
875
|
-
*
|
|
876
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
877
|
-
* @param {number} [minLevel=1] - The minimum level (default: 1).
|
|
878
|
-
* @param {number} [maxLevel=254] - The maximum level (default: 254).
|
|
879
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
880
|
-
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
881
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
882
|
-
*/
|
|
883
538
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
884
539
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
885
540
|
currentLevel,
|
|
@@ -895,18 +550,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
895
550
|
});
|
|
896
551
|
return this;
|
|
897
552
|
}
|
|
898
|
-
/**
|
|
899
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
900
|
-
*
|
|
901
|
-
* @param currentX - The current X value.
|
|
902
|
-
* @param currentY - The current Y value.
|
|
903
|
-
* @param currentHue - The current hue value.
|
|
904
|
-
* @param currentSaturation - The current saturation value.
|
|
905
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
906
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
907
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
908
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
909
|
-
*/
|
|
910
553
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
911
554
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
912
555
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -929,19 +572,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
929
572
|
});
|
|
930
573
|
return this;
|
|
931
574
|
}
|
|
932
|
-
/**
|
|
933
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
934
|
-
*
|
|
935
|
-
* @param currentX - The current X value.
|
|
936
|
-
* @param currentY - The current Y value.
|
|
937
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
938
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
939
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
940
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
941
|
-
*
|
|
942
|
-
* @remarks
|
|
943
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
944
|
-
*/
|
|
945
575
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
946
576
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
947
577
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -962,16 +592,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
962
592
|
});
|
|
963
593
|
return this;
|
|
964
594
|
}
|
|
965
|
-
/**
|
|
966
|
-
* Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
967
|
-
*
|
|
968
|
-
* @param currentHue - The current hue value.
|
|
969
|
-
* @param currentSaturation - The current saturation value.
|
|
970
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
971
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
972
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
973
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
974
|
-
*/
|
|
975
595
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
976
596
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
977
597
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -992,14 +612,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
992
612
|
});
|
|
993
613
|
return this;
|
|
994
614
|
}
|
|
995
|
-
/**
|
|
996
|
-
* Creates a color temperature color control cluster server.
|
|
997
|
-
*
|
|
998
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
999
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1000
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1001
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1002
|
-
*/
|
|
1003
615
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1004
616
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1005
617
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1018,23 +630,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1018
630
|
});
|
|
1019
631
|
return this;
|
|
1020
632
|
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Configures the color control mode for the device.
|
|
1023
|
-
*
|
|
1024
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1025
|
-
*/
|
|
1026
633
|
async configureColorControlMode(colorMode) {
|
|
1027
634
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1028
635
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1029
636
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1030
637
|
}
|
|
1031
638
|
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Creates a default window covering cluster server (Lift and PositionAwareLift).
|
|
1034
|
-
*
|
|
1035
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1036
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1037
|
-
*/
|
|
1038
639
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1039
640
|
this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1040
641
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1050,15 +651,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1050
651
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1051
652
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1052
653
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1053
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1054
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
654
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
655
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1055
656
|
});
|
|
1056
657
|
return this;
|
|
1057
658
|
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1060
|
-
*
|
|
1061
|
-
*/
|
|
1062
659
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1063
660
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1064
661
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1071,12 +668,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1071
668
|
}
|
|
1072
669
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1073
670
|
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Sets the current and target status of a window covering.
|
|
1076
|
-
* @param {number} current - The current position of the window covering.
|
|
1077
|
-
* @param {number} target - The target position of the window covering.
|
|
1078
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1079
|
-
*/
|
|
1080
671
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1081
672
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1082
673
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1087,10 +678,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1087
678
|
}, this.log);
|
|
1088
679
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1089
680
|
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Sets the status of the window covering.
|
|
1092
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1093
|
-
*/
|
|
1094
681
|
async setWindowCoveringStatus(status) {
|
|
1095
682
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1096
683
|
global: status,
|
|
@@ -1099,11 +686,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1099
686
|
}, this.log);
|
|
1100
687
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1101
688
|
}
|
|
1102
|
-
/**
|
|
1103
|
-
* Retrieves the status of the window covering.
|
|
1104
|
-
*
|
|
1105
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1106
|
-
*/
|
|
1107
689
|
getWindowCoveringStatus() {
|
|
1108
690
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1109
691
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1111,66 +693,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1111
693
|
return status.global;
|
|
1112
694
|
}
|
|
1113
695
|
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Sets the target and current position of the window covering.
|
|
1116
|
-
*
|
|
1117
|
-
* @param position - The position to set, specified as a number.
|
|
1118
|
-
*/
|
|
1119
696
|
async setWindowCoveringTargetAndCurrentPosition(position) {
|
|
1120
697
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
|
|
1121
698
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
|
|
1122
699
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1123
700
|
}
|
|
1124
|
-
/**
|
|
1125
|
-
* Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
|
|
1126
|
-
*
|
|
1127
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1128
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1129
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1130
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1131
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1132
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1133
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1134
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1135
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1136
|
-
*/
|
|
1137
701
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1138
702
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1139
703
|
localTemperature: localTemperature * 100,
|
|
1140
704
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1141
705
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1142
|
-
// Thermostat.Feature.Heating
|
|
1143
706
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1144
707
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1145
708
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1146
709
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1147
710
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1148
|
-
// Thermostat.Feature.Cooling
|
|
1149
711
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1150
712
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1151
713
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1152
714
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1153
715
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1154
|
-
// Thermostat.Feature.AutoMode
|
|
1155
716
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1156
717
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1157
718
|
});
|
|
1158
719
|
return this;
|
|
1159
720
|
}
|
|
1160
|
-
/**
|
|
1161
|
-
* Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
|
|
1162
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1163
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1164
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1165
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1166
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1167
|
-
*/
|
|
1168
721
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1169
722
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1170
723
|
localTemperature: localTemperature * 100,
|
|
1171
724
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1172
725
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1173
|
-
// Thermostat.Feature.Heating
|
|
1174
726
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1175
727
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1176
728
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1179,20 +731,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1179
731
|
});
|
|
1180
732
|
return this;
|
|
1181
733
|
}
|
|
1182
|
-
/**
|
|
1183
|
-
* Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
|
|
1184
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1185
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1186
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1187
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1188
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1189
|
-
*/
|
|
1190
734
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1191
735
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1192
736
|
localTemperature: localTemperature * 100,
|
|
1193
737
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1194
738
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1195
|
-
// Thermostat.Feature.Cooling
|
|
1196
739
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1197
740
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1198
741
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1201,12 +744,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1201
744
|
});
|
|
1202
745
|
return this;
|
|
1203
746
|
}
|
|
1204
|
-
/**
|
|
1205
|
-
* Creates a default fan control cluster server.
|
|
1206
|
-
*
|
|
1207
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1208
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1209
|
-
*/
|
|
1210
747
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1211
748
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1212
749
|
fanMode,
|
|
@@ -1219,38 +756,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1219
756
|
});
|
|
1220
757
|
return this;
|
|
1221
758
|
}
|
|
1222
|
-
/**
|
|
1223
|
-
* Creates a default door lock cluster server.
|
|
1224
|
-
*
|
|
1225
|
-
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
|
|
1226
|
-
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
|
|
1227
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1228
|
-
*
|
|
1229
|
-
* @remarks
|
|
1230
|
-
* All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
|
|
1231
|
-
*/
|
|
1232
759
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1233
760
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1234
|
-
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1235
761
|
lockState,
|
|
1236
762
|
lockType,
|
|
1237
763
|
actuatorEnabled: false,
|
|
1238
|
-
|
|
764
|
+
operatingMode: DoorLock.OperatingMode.Normal,
|
|
765
|
+
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
766
|
+
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1239
767
|
});
|
|
1240
768
|
return this;
|
|
1241
769
|
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Creates a default Mode Select cluster server.
|
|
1244
|
-
*
|
|
1245
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1246
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1247
|
-
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1248
|
-
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1249
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1250
|
-
*
|
|
1251
|
-
* @remarks
|
|
1252
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1253
|
-
*/
|
|
1254
770
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1255
771
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1256
772
|
description: description,
|
|
@@ -1261,13 +777,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1261
777
|
});
|
|
1262
778
|
return this;
|
|
1263
779
|
}
|
|
1264
|
-
/**
|
|
1265
|
-
* Creates the default Valve Configuration And Control cluster server.
|
|
1266
|
-
*
|
|
1267
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1268
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1269
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1270
|
-
*/
|
|
1271
780
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1272
781
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1273
782
|
currentState: valveState,
|
|
@@ -1277,15 +786,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1277
786
|
openDuration: null,
|
|
1278
787
|
defaultOpenDuration: null,
|
|
1279
788
|
remainingDuration: null,
|
|
789
|
+
defaultOpenLevel: 100,
|
|
790
|
+
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
791
|
+
levelStep: 1,
|
|
1280
792
|
});
|
|
1281
793
|
return this;
|
|
1282
794
|
}
|
|
1283
|
-
/**
|
|
1284
|
-
* Creates the default PumpConfigurationAndControl cluster server.
|
|
1285
|
-
*
|
|
1286
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1287
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1288
|
-
*/
|
|
1289
795
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1290
796
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1291
797
|
minConstSpeed: null,
|
|
@@ -1300,13 +806,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1300
806
|
});
|
|
1301
807
|
return this;
|
|
1302
808
|
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Creates the default SmokeCOAlarm Cluster Server.
|
|
1305
|
-
*
|
|
1306
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1307
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1308
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1309
|
-
*/
|
|
1310
809
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1311
810
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1312
811
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1319,17 +818,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1319
818
|
testInProgress: false,
|
|
1320
819
|
hardwareFaultAlert: false,
|
|
1321
820
|
endOfServiceAlert: SmokeCoAlarm.EndOfService.Normal,
|
|
1322
|
-
// interconnectSmokeAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
1323
|
-
// interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
1324
821
|
});
|
|
1325
822
|
return this;
|
|
1326
823
|
}
|
|
1327
|
-
/**
|
|
1328
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server.
|
|
1329
|
-
*
|
|
1330
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1331
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1332
|
-
*/
|
|
1333
824
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1334
825
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1335
826
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1344,12 +835,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1344
835
|
});
|
|
1345
836
|
return this;
|
|
1346
837
|
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Creates a co only SmokeCOAlarm Cluster Server.
|
|
1349
|
-
*
|
|
1350
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1351
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1352
|
-
*/
|
|
1353
838
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1354
839
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1355
840
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1364,13 +849,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1364
849
|
});
|
|
1365
850
|
return this;
|
|
1366
851
|
}
|
|
1367
|
-
/**
|
|
1368
|
-
* Creates a default momentary switch cluster server.
|
|
1369
|
-
*
|
|
1370
|
-
* @remarks
|
|
1371
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1372
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1373
|
-
*/
|
|
1374
852
|
createDefaultSwitchClusterServer() {
|
|
1375
853
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1376
854
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1381,13 +859,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1381
859
|
});
|
|
1382
860
|
return this;
|
|
1383
861
|
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Creates a default latching switch cluster server.
|
|
1386
|
-
*
|
|
1387
|
-
* @remarks
|
|
1388
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1389
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1390
|
-
*/
|
|
1391
862
|
createDefaultLatchingSwitchClusterServer() {
|
|
1392
863
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1393
864
|
events: { switchLatched: true },
|
|
@@ -1397,13 +868,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1397
868
|
});
|
|
1398
869
|
return this;
|
|
1399
870
|
}
|
|
1400
|
-
/**
|
|
1401
|
-
* Triggers a switch event on the specified endpoint.
|
|
1402
|
-
*
|
|
1403
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1404
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1405
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1406
|
-
*/
|
|
1407
871
|
async triggerSwitchEvent(event, log) {
|
|
1408
872
|
if (this.maybeNumber === undefined) {
|
|
1409
873
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1463,31 +927,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1463
927
|
}
|
|
1464
928
|
return true;
|
|
1465
929
|
}
|
|
1466
|
-
/**
|
|
1467
|
-
* Creates a default boolean state cluster server.
|
|
1468
|
-
*
|
|
1469
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1470
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1471
|
-
*/
|
|
1472
930
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1473
931
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1474
932
|
events: { stateChange: true },
|
|
1475
933
|
}), {
|
|
1476
|
-
stateValue: contact ?? true,
|
|
934
|
+
stateValue: contact ?? true,
|
|
1477
935
|
});
|
|
1478
936
|
return this;
|
|
1479
937
|
}
|
|
1480
|
-
/**
|
|
1481
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1482
|
-
*
|
|
1483
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1484
|
-
*
|
|
1485
|
-
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1486
|
-
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1487
|
-
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1488
|
-
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1489
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1490
|
-
*/
|
|
1491
938
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1492
939
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1493
940
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1502,21 +949,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1502
949
|
});
|
|
1503
950
|
return this;
|
|
1504
951
|
}
|
|
1505
|
-
/**
|
|
1506
|
-
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1507
|
-
*
|
|
1508
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1509
|
-
*/
|
|
1510
952
|
createDefaultPowerTopologyClusterServer() {
|
|
1511
953
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1512
954
|
return this;
|
|
1513
955
|
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Creates a default Electrical Energy Measurement Cluster Server.
|
|
1516
|
-
*
|
|
1517
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1518
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1519
|
-
*/
|
|
1520
956
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1521
957
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1522
958
|
accuracy: {
|
|
@@ -1532,15 +968,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1532
968
|
});
|
|
1533
969
|
return this;
|
|
1534
970
|
}
|
|
1535
|
-
/**
|
|
1536
|
-
* Creates a default Electrical Power Measurement Cluster Server.
|
|
1537
|
-
*
|
|
1538
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1539
|
-
* @param {number} current - The current value in milliamperes.
|
|
1540
|
-
* @param {number} power - The power value in milliwatts.
|
|
1541
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1542
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1543
|
-
*/
|
|
1544
971
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1545
972
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1546
973
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1582,109 +1009,55 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1582
1009
|
});
|
|
1583
1010
|
return this;
|
|
1584
1011
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
*
|
|
1588
|
-
* @param {number} measuredValue - The measured value of the temperature x 100.
|
|
1589
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1590
|
-
*/
|
|
1591
|
-
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1592
|
-
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1012
|
+
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1013
|
+
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1593
1014
|
return this;
|
|
1594
1015
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
*
|
|
1598
|
-
* @param {number} measuredValue - The measured value of the relative humidity x 100.
|
|
1599
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1600
|
-
*/
|
|
1601
|
-
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1602
|
-
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1016
|
+
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1017
|
+
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1603
1018
|
return this;
|
|
1604
1019
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
*
|
|
1608
|
-
* @param {number} measuredValue - The measured value for the pressure.
|
|
1609
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1610
|
-
*/
|
|
1611
|
-
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1612
|
-
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1020
|
+
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1021
|
+
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1613
1022
|
return this;
|
|
1614
1023
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
*
|
|
1618
|
-
* @param {number} measuredValue - The measured value of illuminance.
|
|
1619
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1620
|
-
*
|
|
1621
|
-
* @remarks
|
|
1622
|
-
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
1623
|
-
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
1624
|
-
*/
|
|
1625
|
-
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1626
|
-
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1024
|
+
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1025
|
+
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1627
1026
|
return this;
|
|
1628
1027
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
*
|
|
1632
|
-
* @param {number} measuredValue - The measured value of the flow in 10 x m/h.
|
|
1633
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1634
|
-
*/
|
|
1635
|
-
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1636
|
-
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1028
|
+
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1029
|
+
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1637
1030
|
return this;
|
|
1638
1031
|
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
*
|
|
1642
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1643
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1644
|
-
*/
|
|
1645
|
-
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1646
|
-
this.behaviors.require(OccupancySensingServer, getDefaultOccupancySensingClusterServer(occupied));
|
|
1032
|
+
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1033
|
+
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1647
1034
|
return this;
|
|
1648
1035
|
}
|
|
1649
|
-
/**
|
|
1650
|
-
* Creates a default AirQuality cluster server.
|
|
1651
|
-
*
|
|
1652
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1653
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1654
|
-
*/
|
|
1655
1036
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1656
1037
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1657
1038
|
airQuality,
|
|
1658
1039
|
});
|
|
1659
1040
|
return this;
|
|
1660
1041
|
}
|
|
1661
|
-
|
|
1662
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
|
|
1663
|
-
*
|
|
1664
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1665
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1666
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1667
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1668
|
-
*/
|
|
1669
|
-
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1042
|
+
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1670
1043
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1671
1044
|
measuredValue,
|
|
1672
1045
|
minMeasuredValue: null,
|
|
1673
1046
|
maxMeasuredValue: null,
|
|
1674
|
-
uncertainty
|
|
1047
|
+
uncertainty,
|
|
1675
1048
|
measurementUnit,
|
|
1676
1049
|
measurementMedium,
|
|
1677
1050
|
});
|
|
1678
1051
|
return this;
|
|
1679
1052
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue =
|
|
1053
|
+
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1054
|
+
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1055
|
+
levelValue,
|
|
1056
|
+
measurementMedium,
|
|
1057
|
+
});
|
|
1058
|
+
return this;
|
|
1059
|
+
}
|
|
1060
|
+
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1688
1061
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1689
1062
|
measuredValue,
|
|
1690
1063
|
minMeasuredValue: null,
|
|
@@ -1695,14 +1068,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1695
1068
|
});
|
|
1696
1069
|
return this;
|
|
1697
1070
|
}
|
|
1698
|
-
|
|
1699
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server.
|
|
1700
|
-
*
|
|
1701
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1702
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1703
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1704
|
-
*/
|
|
1705
|
-
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1071
|
+
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1706
1072
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1707
1073
|
measuredValue,
|
|
1708
1074
|
minMeasuredValue: null,
|
|
@@ -1713,14 +1079,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1713
1079
|
});
|
|
1714
1080
|
return this;
|
|
1715
1081
|
}
|
|
1716
|
-
|
|
1717
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server.
|
|
1718
|
-
*
|
|
1719
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1720
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1721
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1722
|
-
*/
|
|
1723
|
-
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1082
|
+
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1724
1083
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1725
1084
|
measuredValue,
|
|
1726
1085
|
minMeasuredValue: null,
|
|
@@ -1731,14 +1090,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1731
1090
|
});
|
|
1732
1091
|
return this;
|
|
1733
1092
|
}
|
|
1734
|
-
|
|
1735
|
-
* Create a default Pm1ConcentrationMeasurement cluster server.
|
|
1736
|
-
*
|
|
1737
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1738
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1739
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1740
|
-
*/
|
|
1741
|
-
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1093
|
+
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1742
1094
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1743
1095
|
measuredValue,
|
|
1744
1096
|
minMeasuredValue: null,
|
|
@@ -1749,14 +1101,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1749
1101
|
});
|
|
1750
1102
|
return this;
|
|
1751
1103
|
}
|
|
1752
|
-
|
|
1753
|
-
* Create a default Pm25ConcentrationMeasurement cluster server.
|
|
1754
|
-
*
|
|
1755
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1756
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1757
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1758
|
-
*/
|
|
1759
|
-
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1104
|
+
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1760
1105
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1761
1106
|
measuredValue,
|
|
1762
1107
|
minMeasuredValue: null,
|
|
@@ -1767,14 +1112,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1767
1112
|
});
|
|
1768
1113
|
return this;
|
|
1769
1114
|
}
|
|
1770
|
-
|
|
1771
|
-
* Create a default Pm10ConcentrationMeasurement cluster server.
|
|
1772
|
-
*
|
|
1773
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1774
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1775
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1776
|
-
*/
|
|
1777
|
-
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1115
|
+
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1778
1116
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1779
1117
|
measuredValue,
|
|
1780
1118
|
minMeasuredValue: null,
|
|
@@ -1785,14 +1123,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1785
1123
|
});
|
|
1786
1124
|
return this;
|
|
1787
1125
|
}
|
|
1788
|
-
|
|
1789
|
-
* Create a default OzoneConcentrationMeasurement cluster server.
|
|
1790
|
-
*
|
|
1791
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1792
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1793
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1794
|
-
*/
|
|
1795
|
-
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1126
|
+
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1796
1127
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1797
1128
|
measuredValue,
|
|
1798
1129
|
minMeasuredValue: null,
|
|
@@ -1803,14 +1134,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1803
1134
|
});
|
|
1804
1135
|
return this;
|
|
1805
1136
|
}
|
|
1806
|
-
|
|
1807
|
-
* Create a default RadonConcentrationMeasurement cluster server.
|
|
1808
|
-
*
|
|
1809
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1810
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1811
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1812
|
-
*/
|
|
1813
|
-
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1137
|
+
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1814
1138
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1815
1139
|
measuredValue,
|
|
1816
1140
|
minMeasuredValue: null,
|
|
@@ -1821,14 +1145,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1821
1145
|
});
|
|
1822
1146
|
return this;
|
|
1823
1147
|
}
|
|
1824
|
-
|
|
1825
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server.
|
|
1826
|
-
*
|
|
1827
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1828
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1829
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1830
|
-
*/
|
|
1831
|
-
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1148
|
+
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1832
1149
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1833
1150
|
measuredValue,
|
|
1834
1151
|
minMeasuredValue: null,
|
|
@@ -1839,5 +1156,43 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1839
1156
|
});
|
|
1840
1157
|
return this;
|
|
1841
1158
|
}
|
|
1159
|
+
createDefaultRvcRunModeClusterServer() {
|
|
1160
|
+
this.behaviors.require(RvcRunModeServer, {
|
|
1161
|
+
supportedModes: [
|
|
1162
|
+
{ label: 'Idle', mode: 1, modeTags: [{ value: RvcRunMode.ModeTag.Idle }] },
|
|
1163
|
+
{ label: 'Cleaning', mode: 2, modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }] },
|
|
1164
|
+
],
|
|
1165
|
+
currentMode: 1,
|
|
1166
|
+
});
|
|
1167
|
+
return this;
|
|
1168
|
+
}
|
|
1169
|
+
createDefaultRvcOperationalStateClusterServer() {
|
|
1170
|
+
this.behaviors.require(RvcOperationalStateServer, {
|
|
1171
|
+
phaseList: [],
|
|
1172
|
+
currentPhase: null,
|
|
1173
|
+
operationalStateList: [
|
|
1174
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Stopped, operationalStateLabel: 'Stopped' },
|
|
1175
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
|
|
1176
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
|
|
1177
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Error, operationalStateLabel: 'Error' },
|
|
1178
|
+
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
1179
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
1180
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
|
|
1181
|
+
],
|
|
1182
|
+
operationalState: RvcOperationalState.OperationalState.Stopped,
|
|
1183
|
+
operationalError: { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error' },
|
|
1184
|
+
});
|
|
1185
|
+
return this;
|
|
1186
|
+
}
|
|
1187
|
+
createDefaultRvcCleanModeClusterServer() {
|
|
1188
|
+
this.behaviors.require(RvcCleanModeServer, {
|
|
1189
|
+
supportedModes: [
|
|
1190
|
+
{ label: 'Idle', mode: 1, modeTags: [] },
|
|
1191
|
+
{ label: 'Cleaning', mode: 2, modeTags: [] },
|
|
1192
|
+
{ label: 'SpotCleaning', mode: 3, modeTags: [] },
|
|
1193
|
+
],
|
|
1194
|
+
currentMode: 1,
|
|
1195
|
+
});
|
|
1196
|
+
return this;
|
|
1197
|
+
}
|
|
1842
1198
|
}
|
|
1843
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|