matterbridge 3.1.6-dev-20250720-88d6141 → 3.1.6
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 +6 -4
- package/README-DOCKER.md +35 -0
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +91 -2
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +34 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +30 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +2 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +28 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +24 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +112 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +94 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +48 -1
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/dishwasher.d.ts +91 -0
- package/dist/devices/dishwasher.d.ts.map +1 -0
- package/dist/devices/dishwasher.js +78 -3
- package/dist/devices/dishwasher.js.map +1 -0
- package/dist/devices/evse.d.ts +75 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +74 -10
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +11 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +2 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/extractorHood.d.ts +46 -0
- package/dist/devices/extractorHood.d.ts.map +1 -0
- package/dist/devices/extractorHood.js +42 -0
- package/dist/devices/extractorHood.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +50 -2
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +87 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +83 -6
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +242 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +91 -7
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +93 -7
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +38 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +82 -2
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/dgram/dgram.d.ts +140 -0
- package/dist/dgram/dgram.d.ts.map +1 -0
- package/dist/dgram/dgram.js +348 -0
- package/dist/dgram/dgram.js.map +1 -0
- package/dist/dgram/mdns.d.ts +288 -0
- package/dist/dgram/mdns.d.ts.map +1 -0
- package/dist/dgram/mdns.js +840 -0
- package/dist/dgram/mdns.js.map +1 -0
- package/dist/dgram/multicast.d.ts +65 -0
- package/dist/dgram/multicast.d.ts.map +1 -0
- package/dist/dgram/multicast.js +170 -0
- package/dist/dgram/multicast.js.map +1 -0
- package/dist/dgram/unicast.d.ts +56 -0
- package/dist/dgram/unicast.d.ts.map +1 -0
- package/dist/dgram/unicast.js +91 -0
- package/dist/dgram/unicast.js.map +1 -0
- package/dist/frontend.d.ts +304 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +435 -21
- package/dist/frontend.js.map +1 -0
- package/dist/globalMatterbridge.d.ts +59 -0
- package/dist/globalMatterbridge.d.ts.map +1 -0
- package/dist/globalMatterbridge.js +47 -0
- package/dist/globalMatterbridge.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +53 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +3 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +460 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +810 -52
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +36 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1351 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +68 -5
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +709 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +579 -15
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +36 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1328 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1200 -43
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +3198 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +322 -12
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +310 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +233 -0
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +195 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +25 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +270 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +249 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/shelly.d.ts +174 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +168 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +59 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +54 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +117 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +263 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +59 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +54 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +33 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +38 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +34 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +33 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +39 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +47 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +32 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +39 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +54 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +72 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/error.d.ts +44 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +41 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/export.d.ts +12 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +49 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +58 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +103 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +101 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/network.d.ts +74 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +81 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +33 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +40 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +56 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +62 -9
- package/dist/utils/wait.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -1,29 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the class MatterbridgePlatform.
|
|
3
|
+
*
|
|
4
|
+
* @file matterbridgePlatform.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2024-03-21
|
|
7
|
+
* @version 1.2.1
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
// Node.js module
|
|
1
25
|
import path from 'node:path';
|
|
26
|
+
// AnsiLogger module
|
|
2
27
|
import { CYAN, db, er, nf, wr } from 'node-ansi-logger';
|
|
28
|
+
// Storage module
|
|
3
29
|
import { NodeStorageManager } from 'node-persist-manager';
|
|
4
30
|
import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
|
|
5
31
|
import { isValidArray, isValidObject, isValidString } from './utils/export.js';
|
|
32
|
+
/**
|
|
33
|
+
* Represents the base Matterbridge platform. It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
6
36
|
export class MatterbridgePlatform {
|
|
37
|
+
/** The Matterbridge instance of this Platform. */
|
|
7
38
|
matterbridge;
|
|
39
|
+
/** The logger instance for this platform. */
|
|
8
40
|
log;
|
|
41
|
+
/** The configuration for this platform. */
|
|
9
42
|
config = {};
|
|
43
|
+
/** The name of the platform. Will be set by the loadPlugin() method using the package.json value. */
|
|
10
44
|
name = '';
|
|
45
|
+
/** The type of the platform. Will be set by the extending classes. */
|
|
11
46
|
type = '';
|
|
47
|
+
/** The version of the platform. Will be set by the loadPlugin() method using the package.json value */
|
|
12
48
|
version = '1.0.0';
|
|
49
|
+
/** Platform node storage manager. */
|
|
13
50
|
storage;
|
|
51
|
+
/** Platform context storage. */
|
|
14
52
|
context;
|
|
53
|
+
// Device and entity select in the plugin config UI
|
|
15
54
|
selectDevice = new Map();
|
|
16
55
|
selectEntity = new Map();
|
|
56
|
+
// Promises for storage
|
|
17
57
|
_contextReady;
|
|
18
58
|
_selectDeviceContextReady;
|
|
19
59
|
_selectEntityContextReady;
|
|
60
|
+
/** The ready promise for the platform, which resolves when the platform is fully initialized. */
|
|
20
61
|
ready;
|
|
62
|
+
/** Registered MatterbridgeEndpoint Map by uniqueId */
|
|
21
63
|
_registeredEndpoints = new Map();
|
|
64
|
+
/** Registered MatterbridgeEndpoint Map by deviceName */
|
|
22
65
|
_registeredEndpointsByName = new Map();
|
|
66
|
+
/**
|
|
67
|
+
* Creates an instance of the base MatterbridgePlatform.
|
|
68
|
+
* It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
|
|
69
|
+
* Each plugin must extend the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
|
|
70
|
+
*
|
|
71
|
+
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
72
|
+
* @param {AnsiLogger} log - The logger instance.
|
|
73
|
+
* @param {PlatformConfig} config - The platform configuration.
|
|
74
|
+
*/
|
|
23
75
|
constructor(matterbridge, log, config) {
|
|
24
76
|
this.matterbridge = matterbridge;
|
|
25
77
|
this.log = log;
|
|
26
78
|
this.config = config;
|
|
79
|
+
// create the NodeStorageManager for the plugin platform
|
|
27
80
|
if (!isValidString(this.config.name, 1))
|
|
28
81
|
throw new Error('Platform: the plugin name is missing or invalid.');
|
|
29
82
|
this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
|
|
@@ -34,12 +87,14 @@ export class MatterbridgePlatform {
|
|
|
34
87
|
logging: false,
|
|
35
88
|
forgiveParseErrors: true,
|
|
36
89
|
});
|
|
90
|
+
// create the context storage for the plugin platform
|
|
37
91
|
this.log.debug(`Creating context for plugin ${this.config.name}`);
|
|
38
92
|
this._contextReady = this.storage.createStorage('context').then((context) => {
|
|
39
93
|
this.context = context;
|
|
40
94
|
this.log.debug(`Created context for plugin ${this.config.name}`);
|
|
41
95
|
return;
|
|
42
96
|
});
|
|
97
|
+
// create the selectDevice storage for the plugin platform
|
|
43
98
|
this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
|
|
44
99
|
this._selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
|
|
45
100
|
const selectDevice = await context.get('selectDevice', []);
|
|
@@ -48,6 +103,7 @@ export class MatterbridgePlatform {
|
|
|
48
103
|
this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
|
|
49
104
|
return;
|
|
50
105
|
});
|
|
106
|
+
// create the selectEntity storage for the plugin platform
|
|
51
107
|
this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
|
|
52
108
|
this._selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
|
|
53
109
|
const selectEntity = await context.get('selectEntity', []);
|
|
@@ -56,47 +112,126 @@ export class MatterbridgePlatform {
|
|
|
56
112
|
this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
|
|
57
113
|
return;
|
|
58
114
|
});
|
|
115
|
+
// Create the `ready` promise for the platform
|
|
59
116
|
this.ready = Promise.all([this._contextReady, this._selectDeviceContextReady, this._selectEntityContextReady]).then(() => {
|
|
60
117
|
this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
|
|
61
118
|
return;
|
|
62
119
|
});
|
|
63
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* This method must be overridden in the extended class.
|
|
123
|
+
* It is called when the platform is started.
|
|
124
|
+
* Use this method to create the MatterbridgeEndpoints and call this.registerDevice().
|
|
125
|
+
*
|
|
126
|
+
* @param {string} [reason] - The reason for starting.
|
|
127
|
+
* @throws {Error} - Throws an error if the method is not overridden.
|
|
128
|
+
*/
|
|
64
129
|
async onStart(reason) {
|
|
65
130
|
this.log.error('Plugins must override onStart.', reason);
|
|
66
131
|
throw new Error('Plugins must override onStart.');
|
|
67
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* This method can be overridden in the extended class. In this case always call super.onConfigure() to save the select and run checkEndpointNumbers().
|
|
135
|
+
* It is called after the platform has started.
|
|
136
|
+
* Use this method to perform any configuration of your devices and to override the value of the attributes that are persistent and stored in the
|
|
137
|
+
* matter storage (i.e. the onOff attribute of the OnOff cluster).
|
|
138
|
+
*/
|
|
68
139
|
async onConfigure() {
|
|
69
140
|
this.log.debug(`Configuring platform ${this.name}`);
|
|
141
|
+
// Save the selectDevice and selectEntity
|
|
70
142
|
await this.saveSelects();
|
|
143
|
+
// Check and update the endpoint numbers
|
|
71
144
|
await this.checkEndpointNumbers();
|
|
72
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* This method can be overridden in the extended class. In this case always call super.onShutdown() to save the selects, run checkEndpointNumbers() and cleanup memory.
|
|
148
|
+
* It is called when the platform is shutting down.
|
|
149
|
+
* Use this method to clean up any resources you used in the constructor or onStart.
|
|
150
|
+
*
|
|
151
|
+
* @param {string} [reason] - The reason for shutting down.
|
|
152
|
+
*/
|
|
73
153
|
async onShutdown(reason) {
|
|
74
154
|
this.log.debug(`Shutting down platform ${this.name}`, reason);
|
|
155
|
+
// Save the selectDevice and selectEntity
|
|
75
156
|
await this.saveSelects();
|
|
157
|
+
// Check and update the endpoint numbers
|
|
76
158
|
await this.checkEndpointNumbers();
|
|
159
|
+
// Cleanup memory
|
|
77
160
|
this.selectDevice.clear();
|
|
78
161
|
this.selectEntity.clear();
|
|
79
162
|
this._registeredEndpoints.clear();
|
|
80
163
|
this._registeredEndpointsByName.clear();
|
|
164
|
+
// Close the storage
|
|
81
165
|
await this.context?.close();
|
|
82
166
|
this.context = undefined;
|
|
83
167
|
await this.storage?.close();
|
|
84
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Called when the logger level is changed.
|
|
171
|
+
*
|
|
172
|
+
* @param {LogLevel} logLevel The new logger level.
|
|
173
|
+
*/
|
|
85
174
|
async onChangeLoggerLevel(logLevel) {
|
|
86
175
|
this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
|
|
87
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Called when a plugin config includes an action button or an action button with text field.
|
|
179
|
+
*
|
|
180
|
+
* @param {string} action The action triggered by the button in plugin config.
|
|
181
|
+
* @param {string} value The value of the field of the action button.
|
|
182
|
+
* @param {string} id The id of the schema associated with the action.
|
|
183
|
+
* @param {PlatformConfig} formData The changed form data of the plugin.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* This method can be overridden in the extended class.
|
|
187
|
+
*
|
|
188
|
+
* Use this method to handle the action defined in the plugin schema:
|
|
189
|
+
* ```json
|
|
190
|
+
* "addDevice": {
|
|
191
|
+
* "description": "Manually add a device that has not been discovered with mdns:",
|
|
192
|
+
* "type": "boolean",
|
|
193
|
+
* "buttonText": "ADD", // The text on the button. This is used when the action doesn't include a text field.
|
|
194
|
+
* "buttonField": "ADD", // The text on the button. This is used when the action includes a text field.
|
|
195
|
+
* "buttonClose": false, // optional, default is false. When true, the dialog will close after the action is sent.
|
|
196
|
+
* "buttonSave": false, // optional, default is false. When true, the dialog will close and trigger the restart required after the action is sent.
|
|
197
|
+
* "textPlaceholder": "Enter the device IP address", // optional: the placeholder text for the text field.
|
|
198
|
+
* "default": false
|
|
199
|
+
* },
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
88
202
|
async onAction(action, value, id, formData) {
|
|
89
203
|
this.log.debug(`The plugin ${CYAN}${this.name}${db} doesn't override onAction. Received action ${CYAN}${action}${db}${value ? ' with ' + CYAN + value + db : ''} ${id ? ' for schema ' + CYAN + id + db : ''}`, formData);
|
|
90
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Called when the plugin config has been updated.
|
|
207
|
+
*
|
|
208
|
+
* @param {PlatformConfig} config The new plugin config.
|
|
209
|
+
*/
|
|
91
210
|
async onConfigChanged(config) {
|
|
92
211
|
this.log.debug(`The plugin ${CYAN}${config.name}${db} doesn't override onConfigChanged. Received new config.`);
|
|
93
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Retrieves the devices registered with the platform.
|
|
215
|
+
*
|
|
216
|
+
* @returns {MatterbridgeEndpoint[]} The registered devices.
|
|
217
|
+
*/
|
|
94
218
|
getDevices() {
|
|
95
219
|
return Array.from(this._registeredEndpoints.values());
|
|
96
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Checks if a device with this name is already registered in the platform.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} deviceName - The device name to check.
|
|
225
|
+
* @returns {boolean} True if the device is already registered, false otherwise.
|
|
226
|
+
*/
|
|
97
227
|
hasDeviceName(deviceName) {
|
|
98
228
|
return this._registeredEndpointsByName.has(deviceName);
|
|
99
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Registers a device with the Matterbridge platform.
|
|
232
|
+
*
|
|
233
|
+
* @param {MatterbridgeEndpoint} device - The device to register.
|
|
234
|
+
*/
|
|
100
235
|
async registerDevice(device) {
|
|
101
236
|
device.plugin = this.name;
|
|
102
237
|
if (device.deviceName && this._registeredEndpointsByName.has(device.deviceName)) {
|
|
@@ -112,6 +247,11 @@ export class MatterbridgePlatform {
|
|
|
112
247
|
if (device.deviceName)
|
|
113
248
|
this._registeredEndpointsByName.set(device.deviceName, device);
|
|
114
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Unregisters a device registered with the Matterbridge platform.
|
|
252
|
+
*
|
|
253
|
+
* @param {MatterbridgeEndpoint} device - The device to unregister.
|
|
254
|
+
*/
|
|
115
255
|
async unregisterDevice(device) {
|
|
116
256
|
await this.matterbridge.removeBridgedEndpoint(this.name, device);
|
|
117
257
|
if (device.uniqueId)
|
|
@@ -119,11 +259,24 @@ export class MatterbridgePlatform {
|
|
|
119
259
|
if (device.deviceName)
|
|
120
260
|
this._registeredEndpointsByName.delete(device.deviceName);
|
|
121
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Unregisters all devices registered with the Matterbridge platform.
|
|
264
|
+
*
|
|
265
|
+
* @param {number} [delay] - The delay in milliseconds between removing each bridged endpoint (default: 0).
|
|
266
|
+
*/
|
|
122
267
|
async unregisterAllDevices(delay = 0) {
|
|
123
268
|
await this.matterbridge.removeAllBridgedEndpoints(this.name, delay);
|
|
124
269
|
this._registeredEndpoints.clear();
|
|
125
270
|
this._registeredEndpointsByName.clear();
|
|
126
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Saves the select devices and entities to storage.
|
|
274
|
+
*
|
|
275
|
+
* This method saves the current state of `selectDevice` and `selectEntity` maps to their respective storage.
|
|
276
|
+
* It logs the number of items being saved and ensures that the storage is properly closed after saving.
|
|
277
|
+
*
|
|
278
|
+
* @returns {Promise<void>} A promise that resolves when the save operation is complete.
|
|
279
|
+
*/
|
|
127
280
|
async saveSelects() {
|
|
128
281
|
if (this.storage) {
|
|
129
282
|
this.log.debug(`Saving ${this.selectDevice.size} selectDevice...`);
|
|
@@ -136,15 +289,36 @@ export class MatterbridgePlatform {
|
|
|
136
289
|
await selectEntity.close();
|
|
137
290
|
}
|
|
138
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Clears all the select device and entity maps.
|
|
294
|
+
*
|
|
295
|
+
* @returns {void}
|
|
296
|
+
*/
|
|
139
297
|
async clearSelect() {
|
|
140
298
|
this.selectDevice.clear();
|
|
141
299
|
this.selectEntity.clear();
|
|
142
300
|
await this.saveSelects();
|
|
143
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Clears the select for a single device.
|
|
304
|
+
*
|
|
305
|
+
* @param {string} serial - The serial of the device to clear.
|
|
306
|
+
* @returns {void}
|
|
307
|
+
*/
|
|
144
308
|
async clearDeviceSelect(serial) {
|
|
145
309
|
this.selectDevice.delete(serial);
|
|
146
310
|
await this.saveSelects();
|
|
147
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Set the select device in the platform map.
|
|
314
|
+
*
|
|
315
|
+
* @param {string} serial - The serial number of the device.
|
|
316
|
+
* @param {string} name - The name of the device.
|
|
317
|
+
* @param {string} [configUrl] - The configuration URL of the device.
|
|
318
|
+
* @param {string} [icon] - The icon of the device: 'wifi', 'ble', 'hub'
|
|
319
|
+
* @param {Array<{ name: string; description: string; icon?: string }>} [entities] - The entities associated with the device.
|
|
320
|
+
* @returns {void}
|
|
321
|
+
*/
|
|
148
322
|
setSelectDevice(serial, name, configUrl, icon, entities) {
|
|
149
323
|
const device = this.selectDevice.get(serial);
|
|
150
324
|
if (device) {
|
|
@@ -161,6 +335,15 @@ export class MatterbridgePlatform {
|
|
|
161
335
|
this.selectDevice.set(serial, { serial, name, configUrl, icon, entities });
|
|
162
336
|
}
|
|
163
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Set the select device entity in the platform map.
|
|
340
|
+
*
|
|
341
|
+
* @param {string} serial - The serial number of the device.
|
|
342
|
+
* @param {string} entityName - The name of the entity.
|
|
343
|
+
* @param {string} entityDescription - The description of the entity.
|
|
344
|
+
* @param {string} [entityIcon] - The icon of the entity: 'wifi', 'ble', 'hub', 'component', 'matter'
|
|
345
|
+
* @returns {void}
|
|
346
|
+
*/
|
|
164
347
|
setSelectDeviceEntity(serial, entityName, entityDescription, entityIcon) {
|
|
165
348
|
const device = this.selectDevice.get(serial);
|
|
166
349
|
if (device) {
|
|
@@ -170,6 +353,11 @@ export class MatterbridgePlatform {
|
|
|
170
353
|
device.entities.push({ name: entityName, description: entityDescription, icon: entityIcon });
|
|
171
354
|
}
|
|
172
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Retrieves the select devices from the platform map.
|
|
358
|
+
*
|
|
359
|
+
* @returns {{ pluginName: string; serial: string; name: string; configUrl?: string; icon?: string; entities?: { name: string; description: string; icon?: string }[] }[]} The selected devices array.
|
|
360
|
+
*/
|
|
173
361
|
getSelectDevices() {
|
|
174
362
|
const selectDevices = [];
|
|
175
363
|
for (const device of this.selectDevice.values()) {
|
|
@@ -177,9 +365,22 @@ export class MatterbridgePlatform {
|
|
|
177
365
|
}
|
|
178
366
|
return selectDevices;
|
|
179
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Set the select entity in the platform map.
|
|
370
|
+
*
|
|
371
|
+
* @param {string} name - The entity name.
|
|
372
|
+
* @param {string} description - The entity description.
|
|
373
|
+
* @param {string} [icon] - The entity icon: 'wifi', 'ble', 'hub', 'component', 'matter'
|
|
374
|
+
* @returns {void}
|
|
375
|
+
*/
|
|
180
376
|
setSelectEntity(name, description, icon) {
|
|
181
377
|
this.selectEntity.set(name, { name, description, icon });
|
|
182
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Retrieve the select entities.
|
|
381
|
+
*
|
|
382
|
+
* @returns {{ pluginName: string; name: string; description: string; icon?: string }[]} The select entities array.
|
|
383
|
+
*/
|
|
183
384
|
getSelectEntities() {
|
|
184
385
|
const selectEntities = [];
|
|
185
386
|
for (const entity of this.selectEntity.values()) {
|
|
@@ -187,6 +388,12 @@ export class MatterbridgePlatform {
|
|
|
187
388
|
}
|
|
188
389
|
return selectEntities;
|
|
189
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Verifies if the Matterbridge version meets the required version.
|
|
393
|
+
*
|
|
394
|
+
* @param {string} requiredVersion - The required version to compare against.
|
|
395
|
+
* @returns {boolean} True if the Matterbridge version meets or exceeds the required version, false otherwise.
|
|
396
|
+
*/
|
|
190
397
|
verifyMatterbridgeVersion(requiredVersion) {
|
|
191
398
|
const compareVersions = (matterbridgeVersion, requiredVersion) => {
|
|
192
399
|
const stripTag = (v) => {
|
|
@@ -211,6 +418,14 @@ export class MatterbridgePlatform {
|
|
|
211
418
|
return false;
|
|
212
419
|
return true;
|
|
213
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Validates if a device is allowed based on the whitelist and blacklist configurations.
|
|
423
|
+
* The blacklist has priority over the whitelist.
|
|
424
|
+
*
|
|
425
|
+
* @param {string | string[]} device - The device name(s) to validate.
|
|
426
|
+
* @param {boolean} [log] - Whether to log the validation result.
|
|
427
|
+
* @returns {boolean} - Returns true if the device is allowed, false otherwise.
|
|
428
|
+
*/
|
|
214
429
|
validateDevice(device, log = true) {
|
|
215
430
|
if (!Array.isArray(device))
|
|
216
431
|
device = [device];
|
|
@@ -240,6 +455,14 @@ export class MatterbridgePlatform {
|
|
|
240
455
|
this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
|
|
241
456
|
return false;
|
|
242
457
|
}
|
|
458
|
+
/**
|
|
459
|
+
* Validates if an entity is allowed based on the entity blacklist and device-entity blacklist configurations.
|
|
460
|
+
*
|
|
461
|
+
* @param {string} device - The device to which the entity belongs.
|
|
462
|
+
* @param {string} entity - The entity to validate.
|
|
463
|
+
* @param {boolean} [log] - Whether to log the validation result.
|
|
464
|
+
* @returns {boolean} - Returns true if the entity is allowed, false otherwise.
|
|
465
|
+
*/
|
|
243
466
|
validateEntity(device, entity, log = true) {
|
|
244
467
|
if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
|
|
245
468
|
if (log)
|
|
@@ -258,6 +481,15 @@ export class MatterbridgePlatform {
|
|
|
258
481
|
}
|
|
259
482
|
return true;
|
|
260
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* Checks and updates the endpoint numbers for Matterbridge devices.
|
|
486
|
+
*
|
|
487
|
+
* This method retrieves the list of Matterbridge devices and their child endpoints,
|
|
488
|
+
* compares their current endpoint numbers with the stored ones, and updates the storage
|
|
489
|
+
* if there are any changes. It logs the changes and updates the endpoint numbers accordingly.
|
|
490
|
+
*
|
|
491
|
+
* @returns {Promise<number>} The size of the updated endpoint map, or -1 if storage is not available.
|
|
492
|
+
*/
|
|
261
493
|
async checkEndpointNumbers() {
|
|
262
494
|
if (!this.storage)
|
|
263
495
|
return -1;
|
|
@@ -298,3 +530,4 @@ export class MatterbridgePlatform {
|
|
|
298
530
|
return endpointMap.size;
|
|
299
531
|
}
|
|
300
532
|
}
|
|
533
|
+
//# sourceMappingURL=matterbridgePlatform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterbridgePlatform.js","sourceRoot":"","sources":["../src/matterbridgePlatform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAiB;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,oBAAoB;AACpB,OAAO,EAAc,IAAI,EAAE,EAAE,EAAE,EAAE,EAAY,EAAE,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC9E,i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,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACpD,OAAO,WAAW,CAAC,IAAI,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the types for Matterbridge.
|
|
3
|
+
*
|
|
4
|
+
* @file matterbridgeTypes.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2024-07-12
|
|
7
|
+
* @version 1.0.2
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
import { NodeStorage } from 'node-persist-manager';
|
|
25
|
+
import { LogLevel } from 'node-ansi-logger';
|
|
26
|
+
import { FabricIndex, VendorId, StorageContext, ServerNode, EndpointNumber, Endpoint as EndpointNode } from '@matter/main';
|
|
27
|
+
import { AggregatorEndpoint } from '@matter/main/endpoints/aggregator';
|
|
28
|
+
import { MatterbridgePlatform, PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
|
|
29
|
+
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
30
|
+
export declare const plg = "\u001B[38;5;33m";
|
|
31
|
+
export declare const dev = "\u001B[38;5;79m";
|
|
32
|
+
export declare const typ = "\u001B[38;5;207m";
|
|
33
|
+
export interface RegisteredPlugin extends BaseRegisteredPlugin {
|
|
34
|
+
nodeContext?: NodeStorage;
|
|
35
|
+
storageContext?: StorageContext;
|
|
36
|
+
serverNode?: ServerNode<ServerNode.RootEndpoint>;
|
|
37
|
+
aggregatorNode?: EndpointNode<AggregatorEndpoint>;
|
|
38
|
+
device?: MatterbridgeEndpoint;
|
|
39
|
+
platform?: MatterbridgePlatform;
|
|
40
|
+
reachabilityTimeout?: NodeJS.Timeout;
|
|
41
|
+
}
|
|
42
|
+
export interface BaseRegisteredPlugin {
|
|
43
|
+
name: string;
|
|
44
|
+
version: string;
|
|
45
|
+
description: string;
|
|
46
|
+
author: string;
|
|
47
|
+
path: string;
|
|
48
|
+
type: string;
|
|
49
|
+
latestVersion?: string;
|
|
50
|
+
serialNumber?: string;
|
|
51
|
+
homepage?: string;
|
|
52
|
+
help?: string;
|
|
53
|
+
changelog?: string;
|
|
54
|
+
funding?: string;
|
|
55
|
+
locked?: boolean;
|
|
56
|
+
error?: boolean;
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
loaded?: boolean;
|
|
59
|
+
started?: boolean;
|
|
60
|
+
configured?: boolean;
|
|
61
|
+
restartRequired?: boolean;
|
|
62
|
+
registeredDevices?: number;
|
|
63
|
+
addedDevices?: number;
|
|
64
|
+
configJson?: PlatformConfig;
|
|
65
|
+
schemaJson?: PlatformSchema;
|
|
66
|
+
hasWhiteList?: boolean;
|
|
67
|
+
hasBlackList?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface FrontendRegisteredPlugin extends BaseRegisteredPlugin {
|
|
70
|
+
paired?: boolean;
|
|
71
|
+
qrPairingCode?: string;
|
|
72
|
+
manualPairingCode?: string;
|
|
73
|
+
fabricInformations?: SanitizedExposedFabricInformation[];
|
|
74
|
+
sessionInformations?: SanitizedSession[];
|
|
75
|
+
}
|
|
76
|
+
export interface SystemInformation {
|
|
77
|
+
interfaceName: string;
|
|
78
|
+
macAddress: string;
|
|
79
|
+
ipv4Address: string;
|
|
80
|
+
ipv6Address: string;
|
|
81
|
+
nodeVersion: string;
|
|
82
|
+
hostname: string;
|
|
83
|
+
user: string;
|
|
84
|
+
osType: string;
|
|
85
|
+
osRelease: string;
|
|
86
|
+
osPlatform: string;
|
|
87
|
+
osArch: string;
|
|
88
|
+
totalMemory: string;
|
|
89
|
+
freeMemory: string;
|
|
90
|
+
systemUptime: string;
|
|
91
|
+
processUptime: string;
|
|
92
|
+
cpuUsage: string;
|
|
93
|
+
rss: string;
|
|
94
|
+
heapTotal: string;
|
|
95
|
+
heapUsed: string;
|
|
96
|
+
}
|
|
97
|
+
export interface MatterbridgeInformation {
|
|
98
|
+
homeDirectory: string;
|
|
99
|
+
rootDirectory: string;
|
|
100
|
+
matterbridgeDirectory: string;
|
|
101
|
+
matterbridgePluginDirectory: string;
|
|
102
|
+
matterbridgeCertDirectory: string;
|
|
103
|
+
globalModulesDirectory: string;
|
|
104
|
+
matterbridgeVersion: string;
|
|
105
|
+
matterbridgeLatestVersion: string;
|
|
106
|
+
matterbridgeDevVersion: string;
|
|
107
|
+
matterbridgeSerialNumber: string;
|
|
108
|
+
matterbridgeAdvertise: boolean | undefined;
|
|
109
|
+
matterbridgeEndAdvertise: boolean;
|
|
110
|
+
matterbridgePaired: boolean | undefined;
|
|
111
|
+
matterbridgeQrPairingCode: string | undefined;
|
|
112
|
+
matterbridgeManualPairingCode: string | undefined;
|
|
113
|
+
matterbridgeFabricInformations: SanitizedExposedFabricInformation[] | undefined;
|
|
114
|
+
matterbridgeSessionInformations: SanitizedSession[] | undefined;
|
|
115
|
+
bridgeMode: string;
|
|
116
|
+
restartMode: string;
|
|
117
|
+
virtualMode: 'disabled' | 'outlet' | 'light' | 'switch' | 'mounted_switch';
|
|
118
|
+
readOnly: boolean;
|
|
119
|
+
shellyBoard: boolean;
|
|
120
|
+
shellySysUpdate: boolean;
|
|
121
|
+
shellyMainUpdate: boolean;
|
|
122
|
+
profile?: string;
|
|
123
|
+
loggerLevel: LogLevel;
|
|
124
|
+
fileLogger: boolean;
|
|
125
|
+
matterLoggerLevel: number;
|
|
126
|
+
matterFileLogger: boolean;
|
|
127
|
+
mattermdnsinterface: string | undefined;
|
|
128
|
+
matteripv4address: string | undefined;
|
|
129
|
+
matteripv6address: string | undefined;
|
|
130
|
+
matterPort: number;
|
|
131
|
+
matterDiscriminator: number | undefined;
|
|
132
|
+
matterPasscode: number | undefined;
|
|
133
|
+
restartRequired: boolean;
|
|
134
|
+
updateRequired: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface SanitizedExposedFabricInformation {
|
|
137
|
+
fabricIndex: FabricIndex;
|
|
138
|
+
fabricId: string;
|
|
139
|
+
nodeId: string;
|
|
140
|
+
rootNodeId: string;
|
|
141
|
+
rootVendorId: VendorId;
|
|
142
|
+
rootVendorName: string;
|
|
143
|
+
label: string;
|
|
144
|
+
}
|
|
145
|
+
export interface SanitizedSession {
|
|
146
|
+
name: string;
|
|
147
|
+
nodeId: string;
|
|
148
|
+
peerNodeId: string;
|
|
149
|
+
fabric?: SanitizedExposedFabricInformation;
|
|
150
|
+
isPeerActive: boolean;
|
|
151
|
+
lastInteractionTimestamp: string;
|
|
152
|
+
lastActiveTimestamp: string;
|
|
153
|
+
numberOfActiveSubscriptions: number;
|
|
154
|
+
}
|
|
155
|
+
export interface ApiDevices {
|
|
156
|
+
pluginName: string;
|
|
157
|
+
type: string;
|
|
158
|
+
endpoint: EndpointNumber | undefined;
|
|
159
|
+
name: string;
|
|
160
|
+
serial: string;
|
|
161
|
+
productUrl: string;
|
|
162
|
+
configUrl?: string;
|
|
163
|
+
uniqueId: string;
|
|
164
|
+
reachable: boolean;
|
|
165
|
+
powerSource?: 'ac' | 'dc' | 'ok' | 'warning' | 'critical';
|
|
166
|
+
cluster: string;
|
|
167
|
+
matter?: ApiDevicesMatter;
|
|
168
|
+
}
|
|
169
|
+
export interface ApiDevicesMatter {
|
|
170
|
+
commissioned: boolean;
|
|
171
|
+
fabricInformations?: SanitizedExposedFabricInformation[];
|
|
172
|
+
sessionInformations?: SanitizedSession[];
|
|
173
|
+
qrPairingCode?: string;
|
|
174
|
+
manualPairingCode?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface ApiClustersResponse {
|
|
177
|
+
plugin: string;
|
|
178
|
+
deviceName: string;
|
|
179
|
+
serialNumber: string;
|
|
180
|
+
endpoint: number;
|
|
181
|
+
deviceTypes: number[];
|
|
182
|
+
clusters: ApiClusters[];
|
|
183
|
+
}
|
|
184
|
+
export interface ApiClusters {
|
|
185
|
+
endpoint: string;
|
|
186
|
+
id: string;
|
|
187
|
+
deviceTypes: number[];
|
|
188
|
+
clusterName: string;
|
|
189
|
+
clusterId: string;
|
|
190
|
+
attributeName: string;
|
|
191
|
+
attributeId: string;
|
|
192
|
+
attributeValue: string;
|
|
193
|
+
attributeLocalValue: unknown;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=matterbridgeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterbridgeTypes.d.ts","sourceRoot":"","sources":["../src/matterbridgeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAC3H,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;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