matterbridge 2.0.0-edge.3 → 2.0.0-edge.4
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 +2 -1
- package/dist/deviceManager.js +1 -1
- package/dist/frontend.js +1 -1
- package/dist/index.js +2 -3
- package/dist/matterbridge.js +9 -5
- package/dist/matterbridgeBehaviors.js +16 -3
- package/dist/matterbridgeDeviceTypes.js +79 -2
- package/dist/matterbridgeEndpoint.js +66 -10
- package/dist/matterbridgeEndpointDefault.js +87 -0
- package/dist/matterbridgePlatform.js +2 -6
- package/dist/pluginManager.js +4 -12
- package/npm-shrinkwrap.json +6 -3
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -21,7 +21,7 @@ The legacy old api have been completely removed.
|
|
|
21
21
|
The frontend has a new dark and light mode. The dark mode is now the default mode.
|
|
22
22
|
It is possible to change the mode (Classic, Dark or Light) in Settings, Matterbridge settings.
|
|
23
23
|
|
|
24
|
-
## [2.0.0-edge.
|
|
24
|
+
## [2.0.0-edge.4] - 2025-01-17
|
|
25
25
|
|
|
26
26
|
### Added
|
|
27
27
|
|
|
@@ -39,6 +39,7 @@ It is possible to change the mode (Classic, Dark or Light) in Settings, Matterbr
|
|
|
39
39
|
- [frontend]: WebSocketProvider added a startTimeout of 300 sec. to start ping.
|
|
40
40
|
- [frontend]: WebSocketProvider changed pingIntervalSeconds to 60 sec. and offlineTimeoutSeconds to 50 sec.
|
|
41
41
|
- [frontend]: Search on select is no more case sensitive.
|
|
42
|
+
- [package]: Optimized all imports from matter.js.
|
|
42
43
|
- [package]: Update dependencies.
|
|
43
44
|
|
|
44
45
|
### Fixed
|
package/dist/deviceManager.js
CHANGED
package/dist/frontend.js
CHANGED
|
@@ -6,7 +6,7 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|
|
6
6
|
import os from 'os';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { promises as fs } from 'fs';
|
|
9
|
-
import { AnsiLogger, CYAN, db, debugStringify, er, nf, rs, stringify, UNDERLINE, UNDERLINEOFF, wr, YELLOW } from '
|
|
9
|
+
import { AnsiLogger, CYAN, db, debugStringify, er, nf, rs, stringify, UNDERLINE, UNDERLINEOFF, wr, YELLOW } from './logger/export.js';
|
|
10
10
|
import { createZip, hasParameter, isValidNumber, isValidObject, isValidString } from './utils/utils.js';
|
|
11
11
|
import { plg } from './matterbridgeTypes.js';
|
|
12
12
|
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Matterbridge } from './matterbridge.js';
|
|
2
|
+
export { SemanticNamespace, ClosureTag, CompassDirectionTag, CompassLocationTag, DirectionTag, ElectricalMeasurementTag, LaundryTag, LevelTag, LocationTag, NumberTag, PositionTag, PowerSourceTag, RefrigeratorTag, RoomAirConditionerTag, SwitchesTag, } from '@matter/main';
|
|
2
3
|
export * from '@matter/main/clusters';
|
|
3
4
|
export * from '@matter/main/types';
|
|
4
|
-
export {
|
|
5
|
-
export * from '@project-chip/matter.js/device';
|
|
6
|
-
export * from '@project-chip/matter.js/cluster';
|
|
5
|
+
export { ClusterServer, ClusterClient } from '@project-chip/matter.js/cluster';
|
|
7
6
|
export * from './matterbridge.js';
|
|
8
7
|
export * from './matterbridgeTypes.js';
|
|
9
8
|
export * from './matterbridgeEndpoint.js';
|
package/dist/matterbridge.js
CHANGED
|
@@ -5,17 +5,17 @@ import EventEmitter from 'events';
|
|
|
5
5
|
import os from 'os';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { randomBytes } from 'crypto';
|
|
8
|
-
import { NodeStorageManager } from '
|
|
9
|
-
import { AnsiLogger, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, BRIGHT, RESET, er, nf, rs, wr, RED, GREEN, zb, CYAN, nt } from '
|
|
8
|
+
import { NodeStorageManager } from './storage/export.js';
|
|
9
|
+
import { AnsiLogger, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, BRIGHT, RESET, er, nf, rs, wr, RED, GREEN, zb, CYAN, nt } from './logger/export.js';
|
|
10
10
|
import { logInterfaces, wait, waiter, copyDirectory, getParameter, getIntParameter, hasParameter } from './utils/utils.js';
|
|
11
11
|
import { PluginManager } from './pluginManager.js';
|
|
12
12
|
import { DeviceManager } from './deviceManager.js';
|
|
13
13
|
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
14
14
|
import { bridge } from './matterbridgeDeviceTypes.js';
|
|
15
|
+
import { Frontend } from './frontend.js';
|
|
15
16
|
import { DeviceTypeId, Endpoint as EndpointNode, Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, VendorId, StorageService, Environment, ServerNode } from '@matter/main';
|
|
16
17
|
import { FabricAction, PaseClient } from '@matter/main/protocol';
|
|
17
18
|
import { AggregatorEndpoint } from '@matter/main/endpoints';
|
|
18
|
-
import { Frontend } from './frontend.js';
|
|
19
19
|
const plg = '\u001B[38;5;33m';
|
|
20
20
|
const dev = '\u001B[38;5;79m';
|
|
21
21
|
const typ = '\u001B[38;5;207m';
|
|
@@ -1355,17 +1355,21 @@ export class Matterbridge extends EventEmitter {
|
|
|
1355
1355
|
hardwareVersionString: await storageContext.get('hardwareVersionString'),
|
|
1356
1356
|
},
|
|
1357
1357
|
});
|
|
1358
|
-
const sanitizeFabrics = (fabrics) => {
|
|
1358
|
+
const sanitizeFabrics = (fabrics, resetSessions = false) => {
|
|
1359
1359
|
const sanitizedFabrics = this.sanitizeFabricInformations(Array.from(Object.values(fabrics)));
|
|
1360
1360
|
this.log.info(`Fabrics: ${debugStringify(sanitizedFabrics)}`);
|
|
1361
1361
|
if (this.bridgeMode === 'bridge') {
|
|
1362
1362
|
this.matterbridgeFabricInformations = sanitizedFabrics;
|
|
1363
|
+
if (resetSessions)
|
|
1364
|
+
this.matterbridgeSessionInformations = [];
|
|
1363
1365
|
this.matterbridgePaired = true;
|
|
1364
1366
|
}
|
|
1365
1367
|
if (this.bridgeMode === 'childbridge') {
|
|
1366
1368
|
const plugin = this.plugins.get(storeId);
|
|
1367
1369
|
if (plugin) {
|
|
1368
1370
|
plugin.fabricInformations = sanitizedFabrics;
|
|
1371
|
+
if (resetSessions)
|
|
1372
|
+
plugin.sessionInformations = [];
|
|
1369
1373
|
plugin.paired = true;
|
|
1370
1374
|
}
|
|
1371
1375
|
}
|
|
@@ -1401,7 +1405,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1401
1405
|
}
|
|
1402
1406
|
else {
|
|
1403
1407
|
this.log.notice(`Server node for ${storeId} is already commissioned. Waiting for controllers to connect ...`);
|
|
1404
|
-
sanitizeFabrics(serverNode.state.commissioning.fabrics);
|
|
1408
|
+
sanitizeFabrics(serverNode.state.commissioning.fabrics, true);
|
|
1405
1409
|
}
|
|
1406
1410
|
this.frontend.wssSendRefreshRequired();
|
|
1407
1411
|
});
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { Behavior } from '@matter/main';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { IdentifyServer } from '@matter/main/behaviors/identify';
|
|
3
|
+
import { OnOffServer } from '@matter/main/behaviors/on-off';
|
|
4
|
+
import { LevelControlServer } from '@matter/main/behaviors/level-control';
|
|
5
|
+
import { ColorControlServer } from '@matter/main/behaviors/color-control';
|
|
6
|
+
import { WindowCoveringServer } from '@matter/main/behaviors/window-covering';
|
|
7
|
+
import { DoorLockServer } from '@matter/main/behaviors/door-lock';
|
|
8
|
+
import { FanControlServer } from '@matter/main/behaviors/fan-control';
|
|
9
|
+
import { ThermostatServer } from '@matter/main/behaviors/thermostat';
|
|
10
|
+
import { ValveConfigurationAndControlServer } from '@matter/main/behaviors/valve-configuration-and-control';
|
|
11
|
+
import { BooleanStateConfigurationServer } from '@matter/main/behaviors/boolean-state-configuration';
|
|
12
|
+
import { BooleanStateConfiguration } from '@matter/main/clusters/boolean-state-configuration';
|
|
13
|
+
import { ColorControl } from '@matter/main/clusters/color-control';
|
|
14
|
+
import { FanControl } from '@matter/main/clusters/fan-control';
|
|
15
|
+
import { Thermostat } from '@matter/main/clusters/thermostat';
|
|
16
|
+
import { ValveConfigurationAndControl } from '@matter/main/clusters/valve-configuration-and-control';
|
|
17
|
+
import { WindowCovering } from '@matter/main/clusters/window-covering';
|
|
5
18
|
export class MatterbridgeBehaviorDevice {
|
|
6
19
|
log;
|
|
7
20
|
commandHandler;
|
|
@@ -1,5 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DeviceTypeId } from '@matter/main';
|
|
2
|
+
import { BooleanState } from '@matter/main/clusters/boolean-state';
|
|
3
|
+
import { BooleanStateConfiguration } from '@matter/main/clusters/boolean-state-configuration';
|
|
4
|
+
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
5
|
+
import { CarbonDioxideConcentrationMeasurement } from '@matter/main/clusters/carbon-dioxide-concentration-measurement';
|
|
6
|
+
import { CarbonMonoxideConcentrationMeasurement } from '@matter/main/clusters/carbon-monoxide-concentration-measurement';
|
|
7
|
+
import { ColorControl } from '@matter/main/clusters/color-control';
|
|
8
|
+
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
9
|
+
import { DoorLock } from '@matter/main/clusters/door-lock';
|
|
10
|
+
import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-energy-measurement';
|
|
11
|
+
import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-power-measurement';
|
|
12
|
+
import { FanControl } from '@matter/main/clusters/fan-control';
|
|
13
|
+
import { FixedLabel } from '@matter/main/clusters/fixed-label';
|
|
14
|
+
import { FlowMeasurement } from '@matter/main/clusters/flow-measurement';
|
|
15
|
+
import { FormaldehydeConcentrationMeasurement } from '@matter/main/clusters/formaldehyde-concentration-measurement';
|
|
16
|
+
import { Groups } from '@matter/main/clusters/groups';
|
|
17
|
+
import { Identify } from '@matter/main/clusters/identify';
|
|
18
|
+
import { IlluminanceMeasurement } from '@matter/main/clusters/illuminance-measurement';
|
|
19
|
+
import { LevelControl } from '@matter/main/clusters/level-control';
|
|
20
|
+
import { ModeSelect } from '@matter/main/clusters/mode-select';
|
|
21
|
+
import { NitrogenDioxideConcentrationMeasurement } from '@matter/main/clusters/nitrogen-dioxide-concentration-measurement';
|
|
22
|
+
import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
|
|
23
|
+
import { OnOff } from '@matter/main/clusters/on-off';
|
|
24
|
+
import { OzoneConcentrationMeasurement } from '@matter/main/clusters/ozone-concentration-measurement';
|
|
25
|
+
import { Pm10ConcentrationMeasurement } from '@matter/main/clusters/pm10-concentration-measurement';
|
|
26
|
+
import { Pm1ConcentrationMeasurement } from '@matter/main/clusters/pm1-concentration-measurement';
|
|
27
|
+
import { Pm25ConcentrationMeasurement } from '@matter/main/clusters/pm25-concentration-measurement';
|
|
28
|
+
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
29
|
+
import { PowerTopology } from '@matter/main/clusters/power-topology';
|
|
30
|
+
import { PressureMeasurement } from '@matter/main/clusters/pressure-measurement';
|
|
31
|
+
import { PumpConfigurationAndControl } from '@matter/main/clusters/pump-configuration-and-control';
|
|
32
|
+
import { RadonConcentrationMeasurement } from '@matter/main/clusters/radon-concentration-measurement';
|
|
33
|
+
import { RelativeHumidityMeasurement } from '@matter/main/clusters/relative-humidity-measurement';
|
|
34
|
+
import { SmokeCoAlarm } from '@matter/main/clusters/smoke-co-alarm';
|
|
35
|
+
import { SwitchCluster } from '@matter/main/clusters/switch';
|
|
36
|
+
import { TemperatureMeasurement } from '@matter/main/clusters/temperature-measurement';
|
|
37
|
+
import { Thermostat } from '@matter/main/clusters/thermostat';
|
|
38
|
+
import { TimeSynchronization } from '@matter/main/clusters/time-synchronization';
|
|
39
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/main/clusters/total-volatile-organic-compounds-concentration-measurement';
|
|
40
|
+
import { ValveConfigurationAndControl } from '@matter/main/clusters/valve-configuration-and-control';
|
|
41
|
+
import { WindowCovering } from '@matter/main/clusters/window-covering';
|
|
42
|
+
import { AirQuality } from '@matter/main/clusters/air-quality';
|
|
43
|
+
import { Actions } from '@matter/main/clusters/actions';
|
|
44
|
+
import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/thermostat-user-interface-configuration';
|
|
45
|
+
import { EnergyPreference } from '@matter/main/clusters/energy-preference';
|
|
46
|
+
import { RvcRunMode } from '@matter/main/clusters/rvc-run-mode';
|
|
47
|
+
import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
|
|
48
|
+
import { RvcCleanMode } from '@matter/main/clusters/rvc-clean-mode';
|
|
49
|
+
import { ScenesManagement } from '@matter/main/clusters/scenes-management';
|
|
50
|
+
import { HepaFilterMonitoring } from '@matter/main/clusters/hepa-filter-monitoring';
|
|
51
|
+
import { ActivatedCarbonFilterMonitoring } from '@matter/main/clusters/activated-carbon-filter-monitoring';
|
|
52
|
+
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
|
|
53
|
+
export var DeviceClasses;
|
|
54
|
+
(function (DeviceClasses) {
|
|
55
|
+
DeviceClasses["Node"] = "Node";
|
|
56
|
+
DeviceClasses["Utility"] = "Utility";
|
|
57
|
+
DeviceClasses["App"] = "App";
|
|
58
|
+
DeviceClasses["Simple"] = "Simple";
|
|
59
|
+
DeviceClasses["Dynamic"] = "Dynamic";
|
|
60
|
+
DeviceClasses["Client"] = "Client";
|
|
61
|
+
DeviceClasses["Server"] = "Server";
|
|
62
|
+
DeviceClasses["Composed"] = "Composed";
|
|
63
|
+
DeviceClasses["Multiple"] = "Multiple";
|
|
64
|
+
DeviceClasses["EZInitiator"] = "EZ-Initiator";
|
|
65
|
+
DeviceClasses["EZTarget"] = "EZ-Target";
|
|
66
|
+
DeviceClasses["BridgedPowerSourceInfo"] = "BridgedPowerSourceInfo";
|
|
67
|
+
})(DeviceClasses || (DeviceClasses = {}));
|
|
68
|
+
export const DeviceTypeDefinition = ({ name, code, deviceClass, superSet, revision, requiredServerClusters = [], optionalServerClusters = [], requiredClientClusters = [], optionalClientClusters = [], unknown = false, }) => ({
|
|
69
|
+
name,
|
|
70
|
+
code: DeviceTypeId(code),
|
|
71
|
+
deviceClass,
|
|
72
|
+
superSet,
|
|
73
|
+
revision,
|
|
74
|
+
requiredServerClusters,
|
|
75
|
+
optionalServerClusters,
|
|
76
|
+
requiredClientClusters,
|
|
77
|
+
optionalClientClusters,
|
|
78
|
+
unknown,
|
|
79
|
+
});
|
|
3
80
|
export const bridge = DeviceTypeDefinition({
|
|
4
81
|
name: 'MA-aggregator',
|
|
5
82
|
code: 0x000e,
|
|
@@ -1,13 +1,54 @@
|
|
|
1
1
|
import { createHash } from 'crypto';
|
|
2
|
-
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, rs, zb } from '
|
|
2
|
+
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, rs, zb } from './logger/export.js';
|
|
3
3
|
import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeBooleanStateConfigurationServer, MatterbridgeColorControlServer, MatterbridgeDoorLockServer, MatterbridgeFanControlServer, MatterbridgeIdentifyServer, MatterbridgeLevelControlServer, MatterbridgeOnOffServer, MatterbridgeThermostatServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeWindowCoveringServer, } from './matterbridgeBehaviors.js';
|
|
4
4
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
5
5
|
import { deepCopy, isValidNumber } from './utils/utils.js';
|
|
6
|
-
import { Endpoint, MutableEndpoint, SupportedBehaviors, NamedHandler, Lifecycle } from '@matter/main';
|
|
7
|
-
import { EndpointNumber, VendorId } from '@matter/main';
|
|
8
|
-
import { AirQuality, AirQualityCluster, BasicInformation, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FixedLabel, FixedLabelCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, ModeSelect, ModeSelectCluster, NitrogenDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurementCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, OzoneConcentrationMeasurement, OzoneConcentrationMeasurementCluster, Pm10ConcentrationMeasurement, Pm10ConcentrationMeasurementCluster, Pm1ConcentrationMeasurement, Pm1ConcentrationMeasurementCluster, Pm25ConcentrationMeasurement, Pm25ConcentrationMeasurementCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PowerTopology, PowerTopologyCluster, PressureMeasurement, PressureMeasurementCluster, PumpConfigurationAndControl, PumpConfigurationAndControlCluster, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, UserLabel, UserLabelCluster, ValveConfigurationAndControl, ValveConfigurationAndControlCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
|
|
6
|
+
import { Endpoint, MutableEndpoint, SupportedBehaviors, NamedHandler, Lifecycle, VendorId } from '@matter/main';
|
|
9
7
|
import { MeasurementType, getClusterNameById } from '@matter/main/types';
|
|
10
8
|
import { Specification } from '@matter/main/model';
|
|
9
|
+
import { BasicInformation, BasicInformationCluster } from '@matter/main/clusters/basic-information';
|
|
10
|
+
import { BooleanState, BooleanStateCluster } from '@matter/main/clusters/boolean-state';
|
|
11
|
+
import { BooleanStateConfiguration, BooleanStateConfigurationCluster } from '@matter/main/clusters/boolean-state-configuration';
|
|
12
|
+
import { BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster } from '@matter/main/clusters/bridged-device-basic-information';
|
|
13
|
+
import { CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster } from '@matter/main/clusters/carbon-dioxide-concentration-measurement';
|
|
14
|
+
import { CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster } from '@matter/main/clusters/carbon-monoxide-concentration-measurement';
|
|
15
|
+
import { ColorControl, ColorControlCluster } from '@matter/main/clusters/color-control';
|
|
16
|
+
import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
|
|
17
|
+
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
18
|
+
import { DoorLock, DoorLockCluster } from '@matter/main/clusters/door-lock';
|
|
19
|
+
import { ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster } from '@matter/main/clusters/electrical-energy-measurement';
|
|
20
|
+
import { ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster } from '@matter/main/clusters/electrical-power-measurement';
|
|
21
|
+
import { FanControl, FanControlCluster } from '@matter/main/clusters/fan-control';
|
|
22
|
+
import { FixedLabel, FixedLabelCluster } from '@matter/main/clusters/fixed-label';
|
|
23
|
+
import { FlowMeasurement, FlowMeasurementCluster } from '@matter/main/clusters/flow-measurement';
|
|
24
|
+
import { FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster } from '@matter/main/clusters/formaldehyde-concentration-measurement';
|
|
25
|
+
import { Groups, GroupsCluster } from '@matter/main/clusters/groups';
|
|
26
|
+
import { Identify, IdentifyCluster } from '@matter/main/clusters/identify';
|
|
27
|
+
import { IlluminanceMeasurement, IlluminanceMeasurementCluster } from '@matter/main/clusters/illuminance-measurement';
|
|
28
|
+
import { LevelControl, LevelControlCluster } from '@matter/main/clusters/level-control';
|
|
29
|
+
import { ModeSelect, ModeSelectCluster } from '@matter/main/clusters/mode-select';
|
|
30
|
+
import { NitrogenDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurementCluster } from '@matter/main/clusters/nitrogen-dioxide-concentration-measurement';
|
|
31
|
+
import { OccupancySensing, OccupancySensingCluster } from '@matter/main/clusters/occupancy-sensing';
|
|
32
|
+
import { OnOff, OnOffCluster } from '@matter/main/clusters/on-off';
|
|
33
|
+
import { OzoneConcentrationMeasurement, OzoneConcentrationMeasurementCluster } from '@matter/main/clusters/ozone-concentration-measurement';
|
|
34
|
+
import { Pm10ConcentrationMeasurement, Pm10ConcentrationMeasurementCluster } from '@matter/main/clusters/pm10-concentration-measurement';
|
|
35
|
+
import { Pm1ConcentrationMeasurement, Pm1ConcentrationMeasurementCluster } from '@matter/main/clusters/pm1-concentration-measurement';
|
|
36
|
+
import { Pm25ConcentrationMeasurement, Pm25ConcentrationMeasurementCluster } from '@matter/main/clusters/pm25-concentration-measurement';
|
|
37
|
+
import { PowerSource, PowerSourceCluster } from '@matter/main/clusters/power-source';
|
|
38
|
+
import { PowerTopology, PowerTopologyCluster } from '@matter/main/clusters/power-topology';
|
|
39
|
+
import { PressureMeasurement, PressureMeasurementCluster } from '@matter/main/clusters/pressure-measurement';
|
|
40
|
+
import { PumpConfigurationAndControl, PumpConfigurationAndControlCluster } from '@matter/main/clusters/pump-configuration-and-control';
|
|
41
|
+
import { RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster } from '@matter/main/clusters/radon-concentration-measurement';
|
|
42
|
+
import { RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster } from '@matter/main/clusters/relative-humidity-measurement';
|
|
43
|
+
import { SmokeCoAlarm, SmokeCoAlarmCluster } from '@matter/main/clusters/smoke-co-alarm';
|
|
44
|
+
import { Switch, SwitchCluster } from '@matter/main/clusters/switch';
|
|
45
|
+
import { TemperatureMeasurement, TemperatureMeasurementCluster } from '@matter/main/clusters/temperature-measurement';
|
|
46
|
+
import { Thermostat, ThermostatCluster } from '@matter/main/clusters/thermostat';
|
|
47
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster } from '@matter/main/clusters/total-volatile-organic-compounds-concentration-measurement';
|
|
48
|
+
import { UserLabel, UserLabelCluster } from '@matter/main/clusters/user-label';
|
|
49
|
+
import { ValveConfigurationAndControl, ValveConfigurationAndControlCluster } from '@matter/main/clusters/valve-configuration-and-control';
|
|
50
|
+
import { WindowCovering, WindowCoveringCluster } from '@matter/main/clusters/window-covering';
|
|
51
|
+
import { AirQuality, AirQualityCluster } from '@matter/main/clusters/air-quality';
|
|
11
52
|
import { DescriptorServer } from '@matter/node/behaviors/descriptor';
|
|
12
53
|
import { IdentifyBehavior } from '@matter/node/behaviors/identify';
|
|
13
54
|
import { GroupsServer } from '@matter/node/behaviors/groups';
|
|
@@ -19,7 +60,27 @@ import { FlowMeasurementServer } from '@matter/node/behaviors/flow-measurement';
|
|
|
19
60
|
import { IlluminanceMeasurementServer } from '@matter/node/behaviors/illuminance-measurement';
|
|
20
61
|
import { BooleanStateServer } from '@matter/node/behaviors/boolean-state';
|
|
21
62
|
import { OccupancySensingServer } from '@matter/node/behaviors/occupancy-sensing';
|
|
22
|
-
import { AirQualityServer
|
|
63
|
+
import { AirQualityServer } from '@matter/main/behaviors/air-quality';
|
|
64
|
+
import { BasicInformationServer } from '@matter/main/behaviors/basic-information';
|
|
65
|
+
import { CarbonDioxideConcentrationMeasurementServer } from '@matter/main/behaviors/carbon-dioxide-concentration-measurement';
|
|
66
|
+
import { CarbonMonoxideConcentrationMeasurementServer } from '@matter/main/behaviors/carbon-monoxide-concentration-measurement';
|
|
67
|
+
import { ElectricalEnergyMeasurementServer } from '@matter/main/behaviors/electrical-energy-measurement';
|
|
68
|
+
import { ElectricalPowerMeasurementServer } from '@matter/main/behaviors/electrical-power-measurement';
|
|
69
|
+
import { FixedLabelServer } from '@matter/main/behaviors/fixed-label';
|
|
70
|
+
import { FormaldehydeConcentrationMeasurementServer } from '@matter/main/behaviors/formaldehyde-concentration-measurement';
|
|
71
|
+
import { ModeSelectServer } from '@matter/main/behaviors/mode-select';
|
|
72
|
+
import { NitrogenDioxideConcentrationMeasurementServer } from '@matter/main/behaviors/nitrogen-dioxide-concentration-measurement';
|
|
73
|
+
import { OzoneConcentrationMeasurementServer } from '@matter/main/behaviors/ozone-concentration-measurement';
|
|
74
|
+
import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-concentration-measurement';
|
|
75
|
+
import { Pm1ConcentrationMeasurementServer } from '@matter/main/behaviors/pm1-concentration-measurement';
|
|
76
|
+
import { Pm25ConcentrationMeasurementServer } from '@matter/main/behaviors/pm25-concentration-measurement';
|
|
77
|
+
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
78
|
+
import { PowerTopologyServer } from '@matter/main/behaviors/power-topology';
|
|
79
|
+
import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
|
|
80
|
+
import { SmokeCoAlarmServer } from '@matter/main/behaviors/smoke-co-alarm';
|
|
81
|
+
import { SwitchServer } from '@matter/main/behaviors/switch';
|
|
82
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
83
|
+
import { UserLabelServer } from '@matter/main/behaviors/user-label';
|
|
23
84
|
import { ClusterServer, GroupsClusterHandler } from '@project-chip/matter.js/cluster';
|
|
24
85
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
25
86
|
static bridgeMode = '';
|
|
@@ -1514,11 +1575,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1514
1575
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1515
1576
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
1516
1577
|
}
|
|
1517
|
-
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1518
|
-
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1519
|
-
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1520
|
-
}, {}, {}));
|
|
1521
|
-
}
|
|
1522
1578
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1523
1579
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1524
1580
|
airQuality,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Endpoint, MutableEndpoint, SupportedBehaviors } from '@matter/main';
|
|
2
|
+
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
3
|
+
import { Identify } from '@matter/main/clusters/identify';
|
|
4
|
+
import { OnOff } from '@matter/main/clusters/on-off';
|
|
5
|
+
import { DescriptorServer } from '@matter/node/behaviors/descriptor';
|
|
6
|
+
import { IdentifyServer } from '@matter/node/behaviors/identify';
|
|
7
|
+
import { GroupsServer } from '@matter/node/behaviors/groups';
|
|
8
|
+
import { ScenesManagementServer } from '@matter/node/behaviors/scenes-management';
|
|
9
|
+
import { OnOffServer } from '@matter/main/behaviors/on-off';
|
|
10
|
+
class MatterbridgeEndpoint extends Endpoint {
|
|
11
|
+
constructor(definition, options = {}, debug = false) {
|
|
12
|
+
let deviceTypeList = [];
|
|
13
|
+
let firstDefinition;
|
|
14
|
+
if (Array.isArray(definition)) {
|
|
15
|
+
firstDefinition = definition[0];
|
|
16
|
+
deviceTypeList = Array.from(definition.values()).map((dt) => ({
|
|
17
|
+
deviceType: dt.code,
|
|
18
|
+
revision: dt.revision,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
firstDefinition = definition;
|
|
23
|
+
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
24
|
+
}
|
|
25
|
+
const deviceTypeDefinitionV8 = {
|
|
26
|
+
name: firstDefinition.name.replace('-', '_'),
|
|
27
|
+
deviceType: firstDefinition.code,
|
|
28
|
+
deviceRevision: firstDefinition.revision,
|
|
29
|
+
deviceClass: firstDefinition.deviceClass.toLowerCase(),
|
|
30
|
+
requirements: {
|
|
31
|
+
server: {
|
|
32
|
+
mandatory: {},
|
|
33
|
+
optional: {},
|
|
34
|
+
},
|
|
35
|
+
client: {
|
|
36
|
+
mandatory: {},
|
|
37
|
+
optional: {},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
41
|
+
};
|
|
42
|
+
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
43
|
+
const optionsV8 = {
|
|
44
|
+
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
45
|
+
number: options.endpointId,
|
|
46
|
+
descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
|
|
47
|
+
};
|
|
48
|
+
super(endpointV8, optionsV8);
|
|
49
|
+
}
|
|
50
|
+
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
51
|
+
this.behaviors.require(IdentifyServer, {
|
|
52
|
+
identifyTime,
|
|
53
|
+
identifyType,
|
|
54
|
+
});
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
createDefaultGroupsClusterServer() {
|
|
58
|
+
this.behaviors.require(GroupsServer);
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
createDefaultScenesClusterServer() {
|
|
62
|
+
this.behaviors.require(ScenesManagementServer);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
66
|
+
this.behaviors.require(OnOffServer.with(OnOff.Feature.Lighting), {
|
|
67
|
+
onOff,
|
|
68
|
+
globalSceneControl,
|
|
69
|
+
onTime,
|
|
70
|
+
offWaitTime,
|
|
71
|
+
startUpOnOff,
|
|
72
|
+
});
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
createOnOffClusterServer(onOff = false) {
|
|
76
|
+
this.behaviors.require(OnOffServer, {
|
|
77
|
+
onOff,
|
|
78
|
+
});
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
82
|
+
this.behaviors.require(OnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
83
|
+
onOff,
|
|
84
|
+
});
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
2
1
|
import { isValidArray, isValidObject, isValidString } from './utils/utils.js';
|
|
3
|
-
import { CYAN, db, nf, wr } from '
|
|
4
|
-
import { NodeStorageManager } from '
|
|
2
|
+
import { CYAN, db, nf, wr } from './logger/export.js';
|
|
3
|
+
import { NodeStorageManager } from './storage/export.js';
|
|
5
4
|
import path from 'path';
|
|
6
5
|
export class MatterbridgePlatform {
|
|
7
6
|
matterbridge;
|
|
@@ -175,7 +174,4 @@ export class MatterbridgePlatform {
|
|
|
175
174
|
this.log.debug('Endpoint numbers check completed.');
|
|
176
175
|
return endpointMap.size;
|
|
177
176
|
}
|
|
178
|
-
async _createMutableDevice(definition, options = {}, debug = false) {
|
|
179
|
-
return new MatterbridgeEndpoint(definition, options, debug);
|
|
180
|
-
}
|
|
181
177
|
}
|
package/dist/pluginManager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnsiLogger, BLUE, db, er, nf, nt, rs, UNDERLINE, UNDERLINEOFF, wr } from '
|
|
1
|
+
import { AnsiLogger, BLUE, db, er, nf, nt, rs, UNDERLINE, UNDERLINEOFF, wr } from './logger/export.js';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { promises as fs } from 'fs';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
@@ -650,7 +650,7 @@ export class PluginManager {
|
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
async loadSchema(plugin) {
|
|
653
|
-
|
|
653
|
+
const schemaFile = plugin.path.replace('package.json', `${plugin.name}.schema.json`);
|
|
654
654
|
try {
|
|
655
655
|
await fs.access(schemaFile);
|
|
656
656
|
const data = await fs.readFile(schemaFile, 'utf8');
|
|
@@ -658,18 +658,10 @@ export class PluginManager {
|
|
|
658
658
|
schema.title = plugin.description;
|
|
659
659
|
schema.description = plugin.name + ' v. ' + plugin.version + ' by ' + plugin.author;
|
|
660
660
|
this.log.debug(`Loaded schema file ${schemaFile} for plugin ${plg}${plugin.name}${db}.`);
|
|
661
|
-
schemaFile = path.join(this.matterbridge.matterbridgeDirectory, `${plugin.name}.schema.json`);
|
|
662
|
-
try {
|
|
663
|
-
await fs.unlink(schemaFile);
|
|
664
|
-
this.log.debug(`Schema file ${schemaFile} deleted.`);
|
|
665
|
-
}
|
|
666
|
-
catch (err) {
|
|
667
|
-
this.log.debug(`Schema file ${schemaFile} to delete not found.`);
|
|
668
|
-
}
|
|
669
661
|
return schema;
|
|
670
662
|
}
|
|
671
|
-
catch (
|
|
672
|
-
this.log.debug(`Schema file ${schemaFile} for plugin ${plg}${plugin.name}${db} not found. Loading default schema
|
|
663
|
+
catch (error) {
|
|
664
|
+
this.log.debug(`Schema file ${schemaFile} for plugin ${plg}${plugin.name}${db} not found. Loading default schema. Error: ${error instanceof Error ? error.message : error}`);
|
|
673
665
|
return this.getDefaultSchema(plugin);
|
|
674
666
|
}
|
|
675
667
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "2.0.0-edge.
|
|
3
|
+
"version": "2.0.0-edge.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "2.0.0-edge.
|
|
9
|
+
"version": "2.0.0-edge.4",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.11.9",
|
|
13
|
-
"@matter/nodejs": "0.11.9",
|
|
14
13
|
"@project-chip/matter.js": "0.11.9",
|
|
15
14
|
"archiver": "7.0.1",
|
|
16
15
|
"express": "4.21.2",
|
|
@@ -102,6 +101,7 @@
|
|
|
102
101
|
"resolved": "https://registry.npmjs.org/@matter/nodejs/-/nodejs-0.11.9.tgz",
|
|
103
102
|
"integrity": "sha512-NJR2lKElalnjljl+KXgmXcLrdoaK4MH/BA57RYJ2KC3e5ZD+oxhFXfIxCUm37p7anlvv6GcK9ELkJyNaB0zg8A==",
|
|
104
103
|
"license": "Apache-2.0",
|
|
104
|
+
"optional": true,
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@matter/general": "0.11.9",
|
|
107
107
|
"@matter/node": "0.11.9",
|
|
@@ -1083,6 +1083,7 @@
|
|
|
1083
1083
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
|
1084
1084
|
"integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
|
|
1085
1085
|
"license": "MIT",
|
|
1086
|
+
"optional": true,
|
|
1086
1087
|
"engines": {
|
|
1087
1088
|
"node": ">=0.8.19"
|
|
1088
1089
|
}
|
|
@@ -1309,6 +1310,7 @@
|
|
|
1309
1310
|
"resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-3.0.5.tgz",
|
|
1310
1311
|
"integrity": "sha512-GCwtK33iwVXboZWYcqQHu3aRvXEBwmPkAMRBLeaX86ufhqslyUkLGsi4aW3INEfdQYpUB5M9qtYf3eHvAk2VBg==",
|
|
1311
1312
|
"license": "MIT",
|
|
1313
|
+
"optional": true,
|
|
1312
1314
|
"dependencies": {
|
|
1313
1315
|
"write-file-atomic": "^5.0.1"
|
|
1314
1316
|
},
|
|
@@ -1321,6 +1323,7 @@
|
|
|
1321
1323
|
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz",
|
|
1322
1324
|
"integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==",
|
|
1323
1325
|
"license": "ISC",
|
|
1326
|
+
"optional": true,
|
|
1324
1327
|
"dependencies": {
|
|
1325
1328
|
"imurmurhash": "^0.1.4",
|
|
1326
1329
|
"signal-exit": "^4.0.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "2.0.0-edge.
|
|
3
|
+
"version": "2.0.0-edge.4",
|
|
4
4
|
"description": "Matterbridge plugin manager for Matter",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@matter/main": "0.11.9",
|
|
78
|
-
"@matter/nodejs": "0.11.9",
|
|
79
78
|
"@project-chip/matter.js": "0.11.9",
|
|
80
79
|
"archiver": "7.0.1",
|
|
81
80
|
"express": "4.21.2",
|