@matterbridge/core 3.11.3-dev-20261107-92e4713 → 3.11.3-dev-20261113-e1fbc0d

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.
Files changed (35) hide show
  1. package/dist/backend.d.ts +1 -0
  2. package/dist/backend.js +7 -6
  3. package/dist/backendExpress.d.ts +0 -1
  4. package/dist/backendExpress.js +11 -1
  5. package/dist/backendWsServer.d.ts +2 -1
  6. package/dist/backendWsServer.js +113 -6
  7. package/dist/behaviors/export.d.ts +3 -0
  8. package/dist/behaviors/export.js +3 -0
  9. package/dist/behaviors/snapshot.js +0 -19
  10. package/dist/behaviors/timeSynchronizationServer.d.ts +34 -0
  11. package/dist/behaviors/timeSynchronizationServer.js +202 -0
  12. package/dist/behaviors/tlsCertificateManagementServer.d.ts +58 -0
  13. package/dist/behaviors/tlsCertificateManagementServer.js +352 -0
  14. package/dist/behaviors/tlsClientManagementServer.d.ts +21 -0
  15. package/dist/behaviors/tlsClientManagementServer.js +110 -0
  16. package/dist/behaviors/windowCoveringServer.d.ts +63 -0
  17. package/dist/behaviors/windowCoveringServer.js +3 -0
  18. package/dist/cli.js +1 -1
  19. package/dist/clusters/closure-control.js +1 -1
  20. package/dist/clusters/closure-dimension.js +1 -1
  21. package/dist/clusters/soil-measurement.js +1 -1
  22. package/dist/frontend.d.ts +2 -2
  23. package/dist/frontend.js +36 -36
  24. package/dist/matterNode.d.ts +4 -1
  25. package/dist/matterNode.js +58 -20
  26. package/dist/matterNodeHelpers.d.ts +102 -0
  27. package/dist/matterNodeHelpers.js +44 -0
  28. package/dist/matterbridge.js +15 -19
  29. package/dist/matterbridgeEndpoint.js +5 -63
  30. package/dist/matterbridgeEndpointCommandHandler.d.ts +0 -25
  31. package/dist/matterbridgeEndpointHelpers.d.ts +5 -0
  32. package/dist/matterbridgeEndpointHelpers.js +82 -3
  33. package/dist/matterbridgePlatform.js +52 -0
  34. package/dist/pluginManager.js +24 -1
  35. package/package.json +5 -5
@@ -6,7 +6,7 @@ export const ClosureDimensionDefinition = ClusterElement({
6
6
  classification: 'application',
7
7
  }, AttributeElement({ name: 'ClusterRevision', id: 0xfffd, type: 'ClusterRevision', default: 1 }), AttributeElement({ name: 'FeatureMap', id: 0xfffc, type: 'FeatureMap' }, FieldElement({ name: 'PS', conformance: 'O', constraint: '0', title: 'Positioning' }), FieldElement({ name: 'LT', conformance: 'O', constraint: '1', title: 'MotionLatching' }), FieldElement({ name: 'UT', conformance: '[PS]', constraint: '2', title: 'Unit' }), FieldElement({ name: 'LM', conformance: '[PS]', constraint: '3', title: 'Limitation' }), FieldElement({ name: 'SP', conformance: '[PS]', constraint: '4', title: 'Speed' }), FieldElement({ name: 'TR', conformance: '[PS]', constraint: '5', title: 'Translation' }), FieldElement({ name: 'RO', conformance: '[PS]', constraint: '6', title: 'Rotation' }), FieldElement({ name: 'MD', conformance: '[PS]', constraint: '7', title: 'Modulation' })), AttributeElement({ name: 'CurrentState', id: 0x0000, type: 'DimensionStateStruct', access: 'R V', conformance: 'M', default: null, quality: 'X' }), AttributeElement({ name: 'TargetState', id: 0x0001, type: 'DimensionStateStruct', access: 'R V', conformance: 'M', default: null, quality: 'X' }), AttributeElement({ name: 'Resolution', id: 0x0002, type: 'percent100ths', access: 'R V', conformance: 'PS', default: 1, quality: 'F' }), AttributeElement({ name: 'StepValue', id: 0x0003, type: 'percent100ths', access: 'R V', conformance: 'PS', default: 1, quality: 'F' }), AttributeElement({ name: 'Unit', id: 0x0004, type: 'ClosureUnitEnum', access: 'R V', conformance: 'UT', quality: 'F' }), AttributeElement({ name: 'UnitRange', id: 0x0005, type: 'UnitRangeStruct', access: 'R V', conformance: 'UT', default: null, quality: 'X' }), AttributeElement({ name: 'LimitRange', id: 0x0006, type: 'RangePercent100thsStruct', access: 'R V', conformance: 'LM' }), AttributeElement({ name: 'TranslationDirection', id: 0x0007, type: 'TranslationDirectionEnum', access: 'R V', conformance: 'TR', quality: 'F' }), AttributeElement({ name: 'RotationAxis', id: 0x0008, type: 'RotationAxisEnum', access: 'R V', conformance: 'RO', quality: 'F' }), AttributeElement({ name: 'Overflow', id: 0x0009, type: 'OverflowEnum', access: 'R V', conformance: 'RO', quality: 'F' }), AttributeElement({ name: 'ModulationType', id: 0x000a, type: 'ModulationTypeEnum', access: 'R V', conformance: 'MD', quality: 'F' }), AttributeElement({ name: 'LatchControlModes', id: 0x000b, type: 'LatchControlModesBitmap', access: 'R V', conformance: 'LT', quality: 'F' }), CommandElement({ name: 'SetTarget', id: 0x0000, access: 'O T', conformance: 'M', direction: 'request', response: 'status' }, FieldElement({ name: 'Position', id: 0x0, type: 'percent100ths', conformance: 'O' }), FieldElement({ name: 'Latch', id: 0x1, type: 'bool', conformance: 'O' }), FieldElement({ name: 'Speed', id: 0x2, type: 'ThreeLevelAutoEnum', conformance: 'O' })), CommandElement({ name: 'Step', id: 0x0001, access: 'O T', conformance: 'PS', direction: 'request', response: 'status' }, FieldElement({ name: 'Direction', id: 0x0, type: 'StepDirectionEnum', conformance: 'M' }), FieldElement({ name: 'NumberOfSteps', id: 0x1, type: 'uint16', conformance: 'M', constraint: 'min 1' }), FieldElement({ name: 'Speed', id: 0x2, type: 'ThreeLevelAutoEnum', conformance: 'O' })), DatatypeElement({ name: 'ClosureUnitEnum', type: 'enum8' }, FieldElement({ name: 'Millimeter', id: 0x0, conformance: 'M' }), FieldElement({ name: 'Degree', id: 0x1, conformance: 'M' })), DatatypeElement({ name: 'ModulationTypeEnum', type: 'enum8' }, FieldElement({ name: 'SlatsOrientation', id: 0x0, conformance: 'M' }), FieldElement({ name: 'SlatsOpenwork', id: 0x1, conformance: 'M' }), FieldElement({ name: 'StripesAlignment', id: 0x2, conformance: 'M' }), FieldElement({ name: 'Opacity', id: 0x3, conformance: 'M' }), FieldElement({ name: 'Ventilation', id: 0x4, conformance: 'M' })), DatatypeElement({ name: 'OverflowEnum', type: 'enum8' }, FieldElement({ name: 'NoOverflow', id: 0x0, conformance: 'M' }), FieldElement({ name: 'Inside', id: 0x1, conformance: 'M' }), FieldElement({ name: 'Outside', id: 0x2, conformance: 'M' }), FieldElement({ name: 'TopInside', id: 0x3, conformance: 'M' }), FieldElement({ name: 'TopOutside', id: 0x4, conformance: 'M' }), FieldElement({ name: 'BottomInside', id: 0x5, conformance: 'M' }), FieldElement({ name: 'BottomOutside', id: 0x6, conformance: 'M' }), FieldElement({ name: 'LeftInside', id: 0x7, conformance: 'M' }), FieldElement({ name: 'LeftOutside', id: 0x8, conformance: 'M' }), FieldElement({ name: 'RightInside', id: 0x9, conformance: 'M' }), FieldElement({ name: 'RightOutside', id: 0x0a, conformance: 'M' })), DatatypeElement({ name: 'RotationAxisEnum', type: 'enum8' }, FieldElement({ name: 'Left', id: 0x0, conformance: 'M' }), FieldElement({ name: 'CenteredVertical', id: 0x1, conformance: 'M' }), FieldElement({ name: 'LeftAndRight', id: 0x2, conformance: 'M' }), FieldElement({ name: 'Right', id: 0x3, conformance: 'M' }), FieldElement({ name: 'Top', id: 0x4, conformance: 'M' }), FieldElement({ name: 'CenteredHorizontal', id: 0x5, conformance: 'M' }), FieldElement({ name: 'TopAndBottom', id: 0x6, conformance: 'M' }), FieldElement({ name: 'Bottom', id: 0x7, conformance: 'M' }), FieldElement({ name: 'LeftBarrier', id: 0x8, conformance: 'M' }), FieldElement({ name: 'LeftAndRightBarriers', id: 0x9, conformance: 'M' }), FieldElement({ name: 'RightBarrier', id: 0x0a, conformance: 'M' })), DatatypeElement({ name: 'StepDirectionEnum', type: 'enum8' }, FieldElement({ name: 'Decrease', id: 0x0, conformance: 'M' }), FieldElement({ name: 'Increase', id: 0x1, conformance: 'M' })), DatatypeElement({ name: 'TranslationDirectionEnum', type: 'enum8' }, FieldElement({ name: 'Downward', id: 0x0, conformance: 'M' }), FieldElement({ name: 'Upward', id: 0x1, conformance: 'M' }), FieldElement({ name: 'VerticalMask', id: 0x2, conformance: 'M' }), FieldElement({ name: 'VerticalSymmetry', id: 0x3, conformance: 'M' }), FieldElement({ name: 'Leftward', id: 0x4, conformance: 'M' }), FieldElement({ name: 'Rightward', id: 0x5, conformance: 'M' }), FieldElement({ name: 'HorizontalMask', id: 0x6, conformance: 'M' }), FieldElement({ name: 'HorizontalSymmetry', id: 0x7, conformance: 'M' }), FieldElement({ name: 'Forward', id: 0x8, conformance: 'M' }), FieldElement({ name: 'Backward', id: 0x9, conformance: 'M' }), FieldElement({ name: 'DepthMask', id: 0x0a, conformance: 'M' }), FieldElement({ name: 'DepthSymmetry', id: 0x0b, conformance: 'M' })), DatatypeElement({ name: 'LatchControlModesBitmap', type: 'map8' }, FieldElement({ name: 'RemoteLatching', constraint: '0' }), FieldElement({ name: 'RemoteUnlatching', constraint: '1' })), DatatypeElement({ name: 'DimensionStateStruct', type: 'struct' }, FieldElement({ name: 'Position', id: 0x0, type: 'percent100ths', conformance: 'O', default: null, quality: 'X' }), FieldElement({ name: 'Latch', id: 0x1, type: 'bool', conformance: 'O', default: null, quality: 'X' }), FieldElement({ name: 'Speed', id: 0x2, type: 'ThreeLevelAutoEnum', conformance: 'O' })), DatatypeElement({ name: 'RangePercent100thsStruct', type: 'struct' }, FieldElement({ name: 'Min', id: 0x0, type: 'percent100ths', conformance: 'M' }), FieldElement({ name: 'Max', id: 0x1, type: 'percent100ths', conformance: 'M' })), DatatypeElement({ name: 'UnitRangeStruct', type: 'struct' }, FieldElement({ name: 'Min', id: 0x0, type: 'int16', conformance: 'M' }), FieldElement({ name: 'Max', id: 0x1, type: 'int16', conformance: 'M' })));
8
8
  export const ClosureDimensionModel = new ClusterModel(ClosureDimensionDefinition);
9
- if (!MatterDefinition.children.some((child) => child.id === ClosureDimensionDefinition.id)) {
9
+ if (!MatterDefinition.children.some((child) => 'tag' in child && child.tag === 'cluster' && child.id === ClosureDimensionDefinition.id)) {
10
10
  MatterDefinition.children.push(ClosureDimensionDefinition);
11
11
  }
12
12
  if (Matter.clusters(ClosureDimensionModel.id) === undefined) {
@@ -20,7 +20,7 @@ export const SoilMeasurementDefinition = ClusterElement({
20
20
  default: null,
21
21
  }));
22
22
  export const SoilMeasurementModel = new ClusterModel(SoilMeasurementDefinition);
23
- if (!MatterDefinition.children.some((child) => child.id === SoilMeasurementDefinition.id)) {
23
+ if (!MatterDefinition.children.some((child) => 'tag' in child && child.tag === 'cluster' && child.id === SoilMeasurementDefinition.id)) {
24
24
  MatterDefinition.children.push(SoilMeasurementDefinition);
25
25
  }
26
26
  if (Matter.clusters(SoilMeasurementModel.id) === undefined) {
@@ -1,5 +1,5 @@
1
1
  import EventEmitter from 'node:events';
2
- import type { ApiClusters, ApiMatter, BridgeStatus, PluginStatusUpdate, RefreshRequiredChanged, WsMessageBroadcast } from '@matterbridge/types';
2
+ import type { ApiClusters, ApiMatter, ArchiveCommand, BridgeStatus, PluginStatusUpdate, RefreshRequiredChanged, WsMessageBroadcast } from '@matterbridge/types';
3
3
  import { LogLevel } from 'node-ansi-logger';
4
4
  import type { Matterbridge } from './matterbridge.js';
5
5
  interface FrontendEvents {
@@ -53,6 +53,6 @@ export declare class Frontend extends EventEmitter<FrontendEvents> {
53
53
  wssSendAttributeChangedMessage(plugin: string, serialNumber: string, uniqueId: string, number: number, id: string, cluster: string, attribute: string, value: number | string | boolean | null): void;
54
54
  wssBroadcastMessage(msg: WsMessageBroadcast): void;
55
55
  spawn(command: 'install' | 'uninstall', packageName: string): void;
56
- zip(command: 'zip' | 'verify' | 'unzip', archivePath: string, sourcePaths: string[], destinationPath: string): void;
56
+ zip(command: ArchiveCommand, archivePath: string, sourcePaths: string[], destinationPath: string, archiveNames?: string[]): void;
57
57
  }
58
58
  export {};
package/dist/frontend.js CHANGED
@@ -1232,7 +1232,9 @@ export class Frontend extends EventEmitter {
1232
1232
  else if (data.method === '/api/create-backup') {
1233
1233
  this.wssSendSnackbarMessage('Creating matterbridge backup...', 0);
1234
1234
  this.log.notice(`Creating matterbridge backup...`);
1235
- this.zip('zip', path.join(os.tmpdir(), `matterbridge.backup.zip`), [this.matterbridge.matterbridgeDirectory, this.matterbridge.matterbridgePluginDirectory, this.matterbridge.matterbridgeCertDirectory], '');
1235
+ const backupDirs = [this.matterbridge.matterbridgeDirectory, this.matterbridge.matterbridgePluginDirectory, this.matterbridge.matterbridgeCertDirectory];
1236
+ const backupNames = this.matterbridge.profile ? backupDirs.map((dir) => path.basename(path.dirname(path.dirname(dir)))) : undefined;
1237
+ this.zip('zip', path.join(os.tmpdir(), `matterbridge.backup.zip`), backupDirs, '', backupNames);
1236
1238
  sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
1237
1239
  }
1238
1240
  else if (data.method === '/api/create-matterbridge-storage-backup') {
@@ -1707,42 +1709,42 @@ export class Frontend extends EventEmitter {
1707
1709
  sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `Unknown parameter ${data.params.name} in /api/config` });
1708
1710
  }
1709
1711
  }
1710
- else if (data.method === '/api/command') {
1712
+ else if (data.method === '/api/select' || data.method === '/api/unselect') {
1711
1713
  const localData = data;
1712
- if (!isValidString(data.params.command, 5)) {
1713
- sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Wrong parameter command in /api/command' });
1714
+ if (!isValidString(data.params.pluginName, 10) || !isValidString(data.params.serialNumber, 1) || !isValidString(data.params.deviceName, 1)) {
1715
+ sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `Wrong parameters in ${data.method}` });
1714
1716
  return;
1715
1717
  }
1716
- if (data.params.command === 'selectdevice' && isValidString(data.params.plugin, 10) && isValidString(data.params.serial, 1) && isValidString(data.params.name, 1)) {
1717
- const plugin = this.matterbridge.plugins.get(data.params.plugin);
1718
+ if (data.method === '/api/select') {
1719
+ const plugin = this.matterbridge.plugins.get(data.params.pluginName);
1718
1720
  if (!plugin) {
1719
- sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Plugin not found in /api/command' });
1721
+ sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `Plugin not found in ${data.method}` });
1720
1722
  return;
1721
1723
  }
1722
1724
  const config = plugin.configJson;
1723
1725
  const select = plugin.schemaJson?.properties?.blackList?.selectFrom;
1724
1726
  if (select === 'serial')
1725
- this.log.info(`Selected device serial ${data.params.serial}`);
1727
+ this.log.info(`Selected device serial ${data.params.serialNumber}`);
1726
1728
  if (select === 'name')
1727
- this.log.info(`Selected device name ${data.params.name}`);
1729
+ this.log.info(`Selected device name ${data.params.deviceName}`);
1728
1730
  if (config && select && (select === 'serial' || select === 'name')) {
1729
1731
  if (config.postfix) {
1730
- data.params.serial = data.params.serial.replace('-' + config.postfix, '');
1732
+ data.params.serialNumber = data.params.serialNumber.replace('-' + config.postfix, '');
1731
1733
  }
1732
1734
  if (isValidArray(config.whiteList, 1)) {
1733
- if (select === 'serial' && !config.whiteList.includes(data.params.serial)) {
1734
- config.whiteList.push(data.params.serial);
1735
+ if (select === 'serial' && !config.whiteList.includes(data.params.serialNumber)) {
1736
+ config.whiteList.push(data.params.serialNumber);
1735
1737
  }
1736
- else if (select === 'name' && !config.whiteList.includes(data.params.name)) {
1737
- config.whiteList.push(data.params.name);
1738
+ else if (select === 'name' && !config.whiteList.includes(data.params.deviceName)) {
1739
+ config.whiteList.push(data.params.deviceName);
1738
1740
  }
1739
1741
  }
1740
1742
  if (isValidArray(config.blackList, 1)) {
1741
- if (select === 'serial' && config.blackList.includes(data.params.serial)) {
1742
- config.blackList = config.blackList.filter((item) => item !== localData.params.serial);
1743
+ if (select === 'serial' && config.blackList.includes(data.params.serialNumber)) {
1744
+ config.blackList = config.blackList.filter((item) => item !== localData.params.serialNumber);
1743
1745
  }
1744
- else if (select === 'name' && config.blackList.includes(data.params.name)) {
1745
- config.blackList = config.blackList.filter((item) => item !== localData.params.name);
1746
+ else if (select === 'name' && config.blackList.includes(data.params.deviceName)) {
1747
+ config.blackList = config.blackList.filter((item) => item !== localData.params.deviceName);
1746
1748
  }
1747
1749
  }
1748
1750
  if (plugin.platform)
@@ -1759,39 +1761,36 @@ export class Frontend extends EventEmitter {
1759
1761
  sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `SelectDevice: select ${select} not supported` });
1760
1762
  }
1761
1763
  }
1762
- else if (data.params.command === 'unselectdevice' &&
1763
- isValidString(data.params.plugin, 10) &&
1764
- isValidString(data.params.serial, 1) &&
1765
- isValidString(data.params.name, 1)) {
1766
- const plugin = this.matterbridge.plugins.get(data.params.plugin);
1764
+ else {
1765
+ const plugin = this.matterbridge.plugins.get(data.params.pluginName);
1767
1766
  if (!plugin) {
1768
- sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Plugin not found in /api/command' });
1767
+ sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `Plugin not found in ${data.method}` });
1769
1768
  return;
1770
1769
  }
1771
1770
  const config = plugin.configJson;
1772
1771
  const select = plugin.schemaJson?.properties?.blackList?.selectFrom;
1773
1772
  if (select === 'serial')
1774
- this.log.info(`Unselected device serial ${data.params.serial}`);
1773
+ this.log.info(`Unselected device serial ${data.params.serialNumber}`);
1775
1774
  if (select === 'name')
1776
- this.log.info(`Unselected device name ${data.params.name}`);
1775
+ this.log.info(`Unselected device name ${data.params.deviceName}`);
1777
1776
  if (config && select && (select === 'serial' || select === 'name')) {
1778
1777
  if (config.postfix) {
1779
- data.params.serial = data.params.serial.replace('-' + config.postfix, '');
1778
+ data.params.serialNumber = data.params.serialNumber.replace('-' + config.postfix, '');
1780
1779
  }
1781
1780
  if (isValidArray(config.whiteList, 1)) {
1782
- if (select === 'serial' && config.whiteList.includes(data.params.serial)) {
1783
- config.whiteList = config.whiteList.filter((item) => item !== localData.params.serial);
1781
+ if (select === 'serial' && config.whiteList.includes(data.params.serialNumber)) {
1782
+ config.whiteList = config.whiteList.filter((item) => item !== localData.params.serialNumber);
1784
1783
  }
1785
- else if (select === 'name' && config.whiteList.includes(data.params.name)) {
1786
- config.whiteList = config.whiteList.filter((item) => item !== localData.params.name);
1784
+ else if (select === 'name' && config.whiteList.includes(data.params.deviceName)) {
1785
+ config.whiteList = config.whiteList.filter((item) => item !== localData.params.deviceName);
1787
1786
  }
1788
1787
  }
1789
1788
  if (isValidArray(config.blackList)) {
1790
- if (select === 'serial' && !config.blackList.includes(data.params.serial)) {
1791
- config.blackList.push(data.params.serial);
1789
+ if (select === 'serial' && !config.blackList.includes(data.params.serialNumber)) {
1790
+ config.blackList.push(data.params.serialNumber);
1792
1791
  }
1793
- else if (select === 'name' && !config.blackList.includes(data.params.name)) {
1794
- config.blackList.push(data.params.name);
1792
+ else if (select === 'name' && !config.blackList.includes(data.params.deviceName)) {
1793
+ config.blackList.push(data.params.deviceName);
1795
1794
  }
1796
1795
  }
1797
1796
  if (plugin.platform)
@@ -1945,7 +1944,7 @@ export class Frontend extends EventEmitter {
1945
1944
  },
1946
1945
  });
1947
1946
  }
1948
- zip(command, archivePath, sourcePaths, destinationPath) {
1947
+ zip(command, archivePath, sourcePaths, destinationPath, archiveNames) {
1949
1948
  this.server.request({
1950
1949
  type: 'manager_run',
1951
1950
  src: 'frontend',
@@ -1958,6 +1957,7 @@ export class Frontend extends EventEmitter {
1958
1957
  archivePath,
1959
1958
  sourcePaths,
1960
1959
  destinationPath,
1960
+ archiveNames,
1961
1961
  },
1962
1962
  },
1963
1963
  });
@@ -5,7 +5,7 @@ import { Endpoint, ServerNode } from '@matter/node';
5
5
  import { AggregatorEndpoint } from '@matter/node/endpoints/aggregator';
6
6
  import { type DeviceCertification } from '@matter/protocol';
7
7
  import { DeviceTypeId, VendorId } from '@matter/types/datatype';
8
- import type { BridgeStatus, PluginName, PluginStatusUpdate, SharedMatterbridge, WorkerMessage } from '@matterbridge/types';
8
+ import type { BridgeStatus, PlatformConfig, PlatformSchema, PluginName, PluginStatusUpdate, SharedMatterbridge, WorkerMessage } from '@matterbridge/types';
9
9
  import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
10
10
  import { type Plugin, PluginManager } from './pluginManager.js';
11
11
  interface MatterEvents {
@@ -69,6 +69,9 @@ export declare class MatterNode extends EventEmitter<MatterEvents> {
69
69
  subscribeAttributeChanged(plugin: Plugin, device: MatterbridgeEndpoint): Promise<void>;
70
70
  setServerReachability(reachable: boolean): Promise<void>;
71
71
  setAggregatorReachability(aggregatorNode: Endpoint<AggregatorEndpoint>, reachable: boolean): Promise<void>;
72
+ pluginSetConfig(pluginName: string, config: PlatformConfig): void;
73
+ pluginSetSchema(pluginName: string, schema: PlatformSchema): void;
74
+ pluginMatterUpdate(serverNode: ServerNode): void;
72
75
  pluginStatusUpdate(pluginName: string, status: PluginStatusUpdate): void;
73
76
  matterbridgeStatusUpdate(status: BridgeStatus): void;
74
77
  yieldToNode(timeout?: number): Promise<void>;
@@ -7,11 +7,9 @@ import { Crypto, Environment, LogFormat as MatterLogFormat, LogLevel as MatterLo
7
7
  import { Endpoint, ServerNode } from '@matter/node';
8
8
  import { BasicInformationServer } from '@matter/node/behaviors/basic-information';
9
9
  import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
10
- import { PowerSourceServer } from '@matter/node/behaviors/power-source';
11
10
  import { AggregatorEndpoint } from '@matter/node/endpoints/aggregator';
12
11
  import { PaseClient } from '@matter/protocol';
13
- import { PowerSource } from '@matter/types/clusters/power-source';
14
- import { DeviceTypeId, EndpointNumber, VendorId } from '@matter/types/datatype';
12
+ import { DeviceTypeId, VendorId } from '@matter/types/datatype';
15
13
  import { BroadcastServer } from '@matterbridge/thread/server';
16
14
  import { dev, MATTER_STORAGE_DIR, NODE_STORAGE_DIR, plg } from '@matterbridge/types';
17
15
  import { getIntParameter, getParameter, hasAnyParameter, hasParameter } from '@matterbridge/utils/cli';
@@ -24,7 +22,7 @@ import { NodeStorageManager } from 'node-persist-manager';
24
22
  import { addVirtualDevice } from './helpers.js';
25
23
  import { bridge } from './matterbridgeDeviceTypes.js';
26
24
  import { setupLoggers } from './matterLogger.js';
27
- import { deleteAdvertisingNode, getServerNodeData, setAdvertisingNode, toDevice } from './matterNodeHelpers.js';
25
+ import { deleteAdvertisingNode, getServerNodeData, rootCameraEndpoint, rootCameraOptions, setAdvertisingNode, toDevice } from './matterNodeHelpers.js';
28
26
  import { startMatterStorage, stopMatterStorage } from './matterStorage.js';
29
27
  import { PluginManager } from './pluginManager.js';
30
28
  logModuleLoaded('MatterNode');
@@ -200,7 +198,12 @@ export class MatterNode extends EventEmitter {
200
198
  this.log.debug(`Creating MatterNode instance for plugin ${CYAN}${this.pluginName}${db}...`);
201
199
  this.log.debug(`Loading plugin ${CYAN}${this.pluginName}${db}...`);
202
200
  await this.pluginManager.load(this.pluginName);
203
- this.pluginStatusUpdate(this.pluginName, { loaded: this.pluginManager.get(this.pluginName)?.loaded });
201
+ const plugin = this.pluginManager.get(this.pluginName);
202
+ this.pluginStatusUpdate(this.pluginName, { loaded: plugin?.loaded });
203
+ if (plugin?.configJson)
204
+ this.pluginSetConfig(plugin.name, plugin.configJson);
205
+ if (plugin?.schemaJson)
206
+ this.pluginSetSchema(plugin.name, plugin.schemaJson);
204
207
  this.log.debug(`Loaded plugin ${CYAN}${this.pluginName}${db}`);
205
208
  this.log.debug(`Created MatterNode instance for plugin ${CYAN}${this.pluginName}${db}`);
206
209
  this.emit('ready', this.pluginName);
@@ -216,6 +219,10 @@ export class MatterNode extends EventEmitter {
216
219
  await Promise.all(loadPromises);
217
220
  for (const plugin of this.pluginManager.array().filter((p) => p.enabled)) {
218
221
  this.pluginStatusUpdate(plugin.name, { loaded: plugin.loaded });
222
+ if (plugin.configJson)
223
+ this.pluginSetConfig(plugin.name, plugin.configJson);
224
+ if (plugin.schemaJson)
225
+ this.pluginSetSchema(plugin.name, plugin.schemaJson);
219
226
  }
220
227
  this.log.debug('Loaded all plugins');
221
228
  this.log.debug('Created MatterNode instance for all plugins');
@@ -235,6 +242,7 @@ export class MatterNode extends EventEmitter {
235
242
  return;
236
243
  }
237
244
  if (!this.pluginName) {
245
+ this.matterbridgeStatusUpdate('starting');
238
246
  this.log.debug(`Starting all plugins for ${this.storeId}...`);
239
247
  const startPromises = [];
240
248
  for (const plugin of this.pluginManager.array().filter((p) => p.enabled && p.loaded)) {
@@ -243,6 +251,10 @@ export class MatterNode extends EventEmitter {
243
251
  await Promise.all(startPromises);
244
252
  for (const plugin of this.pluginManager.array().filter((p) => p.enabled)) {
245
253
  this.pluginStatusUpdate(plugin.name, { started: plugin.started, registeredDevices: plugin.registeredDevices });
254
+ if (plugin.configJson)
255
+ this.pluginSetConfig(plugin.name, plugin.configJson);
256
+ if (plugin.schemaJson)
257
+ this.pluginSetSchema(plugin.name, plugin.schemaJson);
246
258
  }
247
259
  this.log.debug(`Started all plugins for ${this.storeId}`);
248
260
  this.log.debug(`Starting MatterNode for ${this.storeId}...`);
@@ -264,6 +276,10 @@ export class MatterNode extends EventEmitter {
264
276
  await this.pluginManager.start(this.pluginName, 'Starting MatterNode');
265
277
  const plugin = this.pluginManager.get(this.pluginName);
266
278
  this.pluginStatusUpdate(this.pluginName, { started: plugin?.started, registeredDevices: plugin?.registeredDevices });
279
+ if (plugin?.configJson)
280
+ this.pluginSetConfig(plugin.name, plugin.configJson);
281
+ if (plugin?.schemaJson)
282
+ this.pluginSetSchema(plugin.name, plugin.schemaJson);
267
283
  this.log.debug(`Started plugin ${this.pluginName}...`);
268
284
  this.log.debug(`Starting MatterNode for plugin ${this.storeId}...`);
269
285
  await this.startServerNode();
@@ -278,6 +294,8 @@ export class MatterNode extends EventEmitter {
278
294
  await dependantMatterNode.start();
279
295
  }
280
296
  this.log.debug(`Started dependant MatterNodes for ${this.storeId}`);
297
+ if (!this.pluginName)
298
+ this.matterbridgeStatusUpdate('started');
281
299
  this.log.info(`Started MatterNode for ${this.storeId}`);
282
300
  await this.yieldToNode();
283
301
  }
@@ -298,10 +316,14 @@ export class MatterNode extends EventEmitter {
298
316
  return;
299
317
  }
300
318
  if (!this.pluginName) {
319
+ this.matterbridgeStatusUpdate('stopping');
301
320
  this.log.debug(`Stopping all plugins for ${this.storeId}...`);
302
321
  const shutdownPromises = [];
303
322
  for (const plugin of this.pluginManager.array().filter((p) => p.enabled && p.started)) {
304
- shutdownPromises.push(this.pluginManager.shutdown(plugin, 'Stopping MatterNode'));
323
+ shutdownPromises.push(this.pluginManager.shutdown(plugin, 'Stopping MatterNode').then((result) => {
324
+ this.pluginStatusUpdate(plugin.name, { loaded: plugin.loaded, started: plugin.started, configured: plugin.configured, registeredDevices: plugin.registeredDevices });
325
+ return result;
326
+ }));
305
327
  }
306
328
  await Promise.all(shutdownPromises);
307
329
  this.log.debug(`Stopped all plugins for ${this.storeId}`);
@@ -309,6 +331,8 @@ export class MatterNode extends EventEmitter {
309
331
  else {
310
332
  this.log.debug(`Stopping plugin ${this.pluginName}...`);
311
333
  await this.pluginManager.shutdown(this.pluginName, 'Stopping MatterNode');
334
+ const plugin = this.pluginManager.get(this.pluginName);
335
+ this.pluginStatusUpdate(this.pluginName, { loaded: plugin?.loaded, started: plugin?.started, configured: plugin?.configured, registeredDevices: plugin?.registeredDevices });
312
336
  this.log.debug(`Stopped plugin ${this.pluginName}`);
313
337
  }
314
338
  this.log.debug(`Stopping dependant MatterNodes for ${this.storeId}...`);
@@ -320,6 +344,8 @@ export class MatterNode extends EventEmitter {
320
344
  this.serverNode = undefined;
321
345
  this.aggregatorNode = undefined;
322
346
  await this.stopMatterStorage();
347
+ if (!this.pluginName)
348
+ this.matterbridgeStatusUpdate('stopped');
323
349
  this.log.info(`Stopped MatterNode for ${this.storeId}`);
324
350
  await this.yieldToNode();
325
351
  }
@@ -416,12 +442,14 @@ export class MatterNode extends EventEmitter {
416
442
  this.log.warn(`Invalid discriminator ${discriminator} for server node ${storeId}. Discriminator must be between 0 and 4095 (0xFFF). Generating a random discriminator...`);
417
443
  validDiscriminator = PaseClient.generateRandomDiscriminator(this.environment.get(Crypto));
418
444
  }
445
+ const rootCamera = hasParameter('root-camera') || Boolean(process.env.MATTERBRIDGE_CHIP_TEST);
419
446
  let rootEndpoint;
420
- if (hasParameter('root-power-source') || process.env.MATTERBRIDGE_CHIP_TEST) {
447
+ if (rootCamera) {
421
448
  this.log.warn(' ****************************************************************************************');
422
- this.log.warn(' * Adding the PowerSource cluster server to the root endpoint. *');
449
+ this.log.warn(' * Adding the PowerSource, TimeSynchronization, TlsCertificateManagement and *');
450
+ this.log.warn(' * TlsClientManagement cluster servers to the root endpoint (root camera). *');
423
451
  this.log.warn(' ****************************************************************************************');
424
- rootEndpoint = ServerNode.RootEndpoint.with(PowerSourceServer.with(PowerSource.Feature.Wired));
452
+ rootEndpoint = rootCameraEndpoint();
425
453
  }
426
454
  else {
427
455
  rootEndpoint = ServerNode.RootEndpoint;
@@ -473,26 +501,18 @@ export class MatterNode extends EventEmitter {
473
501
  configurationVersion: await this.matterStorageContext.get('configurationVersion'),
474
502
  reachable: true,
475
503
  },
476
- ...(hasParameter('root-power-source') || process.env.MATTERBRIDGE_CHIP_TEST
477
- ? {
478
- powerSource: {
479
- status: PowerSource.PowerSourceStatus.Active,
480
- order: 0,
481
- description: 'AC Power',
482
- endpointList: [EndpointNumber(0)],
483
- wiredCurrentType: PowerSource.WiredCurrentType.Ac,
484
- },
485
- }
486
- : {}),
504
+ ...(rootCamera ? rootCameraOptions() : {}),
487
505
  });
488
506
  serverNode.lifecycle.commissioned.on(() => {
489
507
  this.log.notice(`Server node for ${storeId} was initially commissioned successfully!`);
490
508
  deleteAdvertisingNode(storeId);
509
+ this.pluginMatterUpdate(serverNode);
491
510
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
492
511
  });
493
512
  serverNode.lifecycle.decommissioned.on(() => {
494
513
  this.log.notice(`Server node for ${storeId} was fully decommissioned successfully!`);
495
514
  deleteAdvertisingNode(storeId);
515
+ this.pluginMatterUpdate(serverNode);
496
516
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
497
517
  this.server.request({ type: 'frontend_snackbarmessage', src: 'matter', dst: 'frontend', params: { message: `${storeId} is offline`, timeout: 5, severity: 'warning' } });
498
518
  this.log.notice(`Server node for ${storeId} was reset to factory defaults: restart Matterbridge before pairing it again`);
@@ -524,6 +544,7 @@ export class MatterNode extends EventEmitter {
524
544
  this.log.notice(`Server node for ${storeId} is already commissioned. Waiting for controllers to connect ...`);
525
545
  deleteAdvertisingNode(storeId);
526
546
  }
547
+ this.pluginMatterUpdate(serverNode);
527
548
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
528
549
  this.server.request({ type: 'frontend_snackbarmessage', src: 'matter', dst: 'frontend', params: { message: `${storeId} is online`, timeout: 5, severity: 'success' } });
529
550
  this.emit('online', storeId);
@@ -531,6 +552,7 @@ export class MatterNode extends EventEmitter {
531
552
  serverNode.lifecycle.offline.on(() => {
532
553
  this.log.notice(`Server node for ${storeId} is offline`);
533
554
  deleteAdvertisingNode(storeId);
555
+ this.pluginMatterUpdate(serverNode);
534
556
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
535
557
  this.server.request({ type: 'frontend_snackbarmessage', src: 'matter', dst: 'frontend', params: { message: `${storeId} is offline`, timeout: 5, severity: 'warning' } });
536
558
  this.emit('offline', storeId);
@@ -550,18 +572,22 @@ export class MatterNode extends EventEmitter {
550
572
  break;
551
573
  }
552
574
  this.log.notice(`Commissioned fabric index ${fabricIndex} ${action} on server node for ${storeId}: ${debugStringify(serverNode.state.commissioning.fabrics[fabricIndex])}`);
575
+ this.pluginMatterUpdate(serverNode);
553
576
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
554
577
  });
555
578
  serverNode.events.sessions.opened.on((session) => {
556
579
  this.log.notice(`Session opened on server node for ${storeId}: ${debugStringify(session)}`);
580
+ this.pluginMatterUpdate(serverNode);
557
581
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
558
582
  });
559
583
  serverNode.events.sessions.closed.on((session) => {
560
584
  this.log.notice(`Session closed on server node for ${storeId}: ${debugStringify(session)}`);
585
+ this.pluginMatterUpdate(serverNode);
561
586
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
562
587
  });
563
588
  serverNode.events.sessions.subscriptionsChanged.on((session) => {
564
589
  this.log.notice(`Session subscriptions changed on server node for ${storeId}: ${debugStringify(session)}`);
590
+ this.pluginMatterUpdate(serverNode);
565
591
  this.server.request({ type: 'frontend_refreshrequired', src: 'matter', dst: 'frontend', params: { changed: 'matter', matter: { ...getServerNodeData(serverNode) } } });
566
592
  });
567
593
  this.storeId = storeId;
@@ -973,6 +999,17 @@ export class MatterNode extends EventEmitter {
973
999
  child.act((agent) => child.eventsOf(BridgedDeviceBasicInformationServer).reachableChanged.emit({ reachableNewValue: true }, agent.context));
974
1000
  }
975
1001
  }
1002
+ pluginSetConfig(pluginName, config) {
1003
+ this.server.request({ type: 'plugins_setconfig', src: 'matter', dst: 'plugins', params: { name: pluginName, config } });
1004
+ }
1005
+ pluginSetSchema(pluginName, schema) {
1006
+ this.server.request({ type: 'plugins_setschema', src: 'matter', dst: 'plugins', params: { name: pluginName, schema } });
1007
+ }
1008
+ pluginMatterUpdate(serverNode) {
1009
+ if (!this.pluginName || this.device)
1010
+ return;
1011
+ this.server.request({ type: 'plugins_set', src: 'matter', dst: 'plugins', params: { plugin: { name: this.pluginName, matter: getServerNodeData(serverNode) } } });
1012
+ }
976
1013
  pluginStatusUpdate(pluginName, status) {
977
1014
  this.server.request({ type: 'plugins_set', src: 'matter', dst: 'plugins', params: { plugin: { name: pluginName, ...status } } });
978
1015
  this.server.request({
@@ -983,6 +1020,7 @@ export class MatterNode extends EventEmitter {
983
1020
  });
984
1021
  }
985
1022
  matterbridgeStatusUpdate(status) {
1023
+ this.server.request({ type: 'matterbridge_apisettings', src: 'matter', dst: 'matterbridge', params: { bridgeStatus: status } });
986
1024
  this.server.request({
987
1025
  type: 'frontend_broadcast_message',
988
1026
  src: 'matter',
@@ -1,7 +1,14 @@
1
1
  import { ServerNode, type SessionsBehavior } from '@matter/node';
2
+ import { PowerSourceServer } from '@matter/node/behaviors/power-source';
2
3
  import type { ExposedFabricInformation } from '@matter/protocol';
4
+ import { PowerSource } from '@matter/types/clusters/power-source';
5
+ import { TimeSynchronization } from '@matter/types/clusters/time-synchronization';
6
+ import { EndpointNumber } from '@matter/types/datatype';
3
7
  import type { ApiClusters, ApiDevice, ApiMatter, Device, SanitizedExposedFabricInformation, SanitizedSession } from '@matterbridge/types';
4
8
  import { type AnsiLogger } from 'node-ansi-logger';
9
+ import { MatterbridgeTimeSynchronizationServer } from './behaviors/timeSynchronizationServer.js';
10
+ import { MatterbridgeTlsCertificateManagementServer } from './behaviors/tlsCertificateManagementServer.js';
11
+ import { MatterbridgeTlsClientManagementServer } from './behaviors/tlsClientManagementServer.js';
5
12
  import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
6
13
  export declare function toApiClusters(endpoint: MatterbridgeEndpoint, log: AnsiLogger): ApiClusters | undefined;
7
14
  export declare function toDevice(device: MatterbridgeEndpoint | Device): Device;
@@ -17,3 +24,98 @@ export declare function getServerNodeData(serverNode: ServerNode): ApiMatter;
17
24
  export declare function sanitizeFabricInformations(fabricInfo: ExposedFabricInformation[]): SanitizedExposedFabricInformation[];
18
25
  export declare function sanitizeSessionInformation(sessions: SessionsBehavior.Session[]): SanitizedSession[];
19
26
  export declare function getVendorIdName(vendorId: number | undefined): string;
27
+ export declare function rootCameraEndpoint(): import("@matter/node").MutableEndpoint.With<import("@matter/node").EndpointType.For<{
28
+ readonly name: "RootNode";
29
+ readonly deviceType: 22;
30
+ readonly deviceRevision: 5;
31
+ readonly deviceClass: import("@matter/model").DeviceClassification.Node;
32
+ readonly requirements: typeof import("@matter/node/endpoints").RootRequirements;
33
+ readonly behaviors: {
34
+ readonly parts: typeof import("@matter/node").PartsBehavior;
35
+ } & {
36
+ readonly index: typeof import("@matter/node").IndexBehavior;
37
+ } & {
38
+ readonly accessControl: typeof import("@matter/node/behaviors").AccessControlServer;
39
+ } & {
40
+ readonly basicInformation: typeof import("@matter/node/behaviors").BasicInformationServer;
41
+ } & {
42
+ readonly generalCommissioning: typeof import("@matter/node/behaviors").GeneralCommissioningServer;
43
+ } & {
44
+ readonly generalDiagnostics: typeof import("@matter/node/behaviors").GeneralDiagnosticsServer;
45
+ } & {
46
+ readonly administratorCommissioning: typeof import("@matter/node/behaviors").AdministratorCommissioningServer;
47
+ } & {
48
+ readonly operationalCredentials: typeof import("@matter/node/behaviors").OperationalCredentialsServer;
49
+ } & {
50
+ readonly groupKeyManagement: typeof import("@matter/node/behaviors").GroupKeyManagementServer;
51
+ };
52
+ }>, import("@matter/node").SupportedBehaviors.With<import("@matter/node").SupportedBehaviors.With<{
53
+ readonly parts: typeof import("@matter/node").PartsBehavior;
54
+ } & {
55
+ readonly index: typeof import("@matter/node").IndexBehavior;
56
+ } & {
57
+ readonly accessControl: typeof import("@matter/node/behaviors").AccessControlServer;
58
+ } & {
59
+ readonly basicInformation: typeof import("@matter/node/behaviors").BasicInformationServer;
60
+ } & {
61
+ readonly generalCommissioning: typeof import("@matter/node/behaviors").GeneralCommissioningServer;
62
+ } & {
63
+ readonly generalDiagnostics: typeof import("@matter/node/behaviors").GeneralDiagnosticsServer;
64
+ } & {
65
+ readonly administratorCommissioning: typeof import("@matter/node/behaviors").AdministratorCommissioningServer;
66
+ } & {
67
+ readonly operationalCredentials: typeof import("@matter/node/behaviors").OperationalCredentialsServer;
68
+ } & {
69
+ readonly groupKeyManagement: typeof import("@matter/node/behaviors").GroupKeyManagementServer;
70
+ }, readonly [typeof import("@matter/node").CommissioningServer, typeof import("@matter/node").NetworkServer, typeof import("@matter/node").ProductDescriptionServer, typeof import("@matter/node").SubscriptionsServer, typeof SessionsBehavior, typeof import("@matter/node").EventsBehavior]>, readonly [import("@matter/node").ClusterBehavior.Type<typeof PowerSourceServer, import("@matter/types/cluster").ClusterType.WithSupportedFeatures<import("@matter/types/cluster").ClusterType.WithSupportedFeatures<import("@matter/types/cluster").ClusterType.WithSupportedFeatures<PowerSource, {
71
+ battery: true;
72
+ rechargeable: true;
73
+ replaceable: false;
74
+ wired: true;
75
+ }>, {
76
+ battery: false;
77
+ rechargeable: false;
78
+ replaceable: false;
79
+ wired: false;
80
+ }>, {
81
+ battery: false;
82
+ rechargeable: false;
83
+ replaceable: false;
84
+ wired: true;
85
+ }>, import("@matter/types/cluster").ClusterType.Concrete, new () => {}, "powerSource">, typeof MatterbridgeTimeSynchronizationServer, typeof MatterbridgeTlsCertificateManagementServer, typeof MatterbridgeTlsClientManagementServer]>, {}>;
86
+ export declare function rootCameraOptions(): {
87
+ powerSource: {
88
+ status: PowerSource.PowerSourceStatus;
89
+ order: number;
90
+ description: string;
91
+ endpointList: EndpointNumber[];
92
+ wiredCurrentType: PowerSource.WiredCurrentType;
93
+ };
94
+ timeSynchronization: {
95
+ utcTime: null;
96
+ granularity: TimeSynchronization.Granularity;
97
+ timeSource: TimeSynchronization.TimeSource;
98
+ trustedTimeSource: null;
99
+ defaultNtp: null;
100
+ supportsDnsResolve: boolean;
101
+ timeZone: {
102
+ offset: number;
103
+ validAt: bigint;
104
+ }[];
105
+ dstOffset: never[];
106
+ localTime: null;
107
+ timeZoneDatabase: TimeSynchronization.TimeZoneDatabase;
108
+ timeZoneListMaxSize: number;
109
+ dstOffsetListMaxSize: number;
110
+ };
111
+ tlsCertificateManagement: {
112
+ maxRootCertificates: number;
113
+ provisionedRootCertificates: never[];
114
+ maxClientCertificates: number;
115
+ provisionedClientCertificates: never[];
116
+ };
117
+ tlsClientManagement: {
118
+ maxProvisioned: number;
119
+ provisionedEndpoints: never[];
120
+ };
121
+ };
@@ -1,5 +1,6 @@
1
1
  import { Lifecycle } from '@matter/general';
2
2
  import { ServerNode } from '@matter/node';
3
+ import { PowerSourceServer } from '@matter/node/behaviors/power-source';
3
4
  import { getClusterNameById } from '@matter/types/cluster';
4
5
  import { AirQuality } from '@matter/types/clusters/air-quality';
5
6
  import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
@@ -11,12 +12,17 @@ import { OperationalState } from '@matter/types/clusters/operational-state';
11
12
  import { PowerSource } from '@matter/types/clusters/power-source';
12
13
  import { RvcOperationalState } from '@matter/types/clusters/rvc-operational-state';
13
14
  import { SmokeCoAlarm } from '@matter/types/clusters/smoke-co-alarm';
15
+ import { TimeSynchronization } from '@matter/types/clusters/time-synchronization';
14
16
  import { UserLabel } from '@matter/types/clusters/user-label';
15
17
  import { ValveConfigurationAndControl } from '@matter/types/clusters/valve-configuration-and-control';
18
+ import { EndpointNumber } from '@matter/types/datatype';
16
19
  import { ThreeLevelAuto } from '@matter/types/globals';
17
20
  import { getEnumDescription } from '@matterbridge/utils/enum';
18
21
  import { isValidArray, isValidNumber, isValidObject } from '@matterbridge/utils/validate';
19
22
  import { stringify } from 'node-ansi-logger';
23
+ import { MATTER_EPOCH_US, MatterbridgeTimeSynchronizationServer } from './behaviors/timeSynchronizationServer.js';
24
+ import { MatterbridgeTlsCertificateManagementServer } from './behaviors/tlsCertificateManagementServer.js';
25
+ import { MatterbridgeTlsClientManagementServer } from './behaviors/tlsClientManagementServer.js';
20
26
  import { capitalizeFirstLetter, featuresFor, getAttribute, getSnapshot } from './matterbridgeEndpointHelpers.js';
21
27
  const advertisingNodes = new Map();
22
28
  export function toApiClusters(endpoint, log) {
@@ -483,3 +489,41 @@ export function getVendorIdName(vendorId) {
483
489
  }
484
490
  return vendorName;
485
491
  }
492
+ export function rootCameraEndpoint() {
493
+ return ServerNode.RootEndpoint.with(PowerSourceServer.with(PowerSource.Feature.Wired), MatterbridgeTimeSynchronizationServer, MatterbridgeTlsCertificateManagementServer, MatterbridgeTlsClientManagementServer);
494
+ }
495
+ export function rootCameraOptions() {
496
+ return {
497
+ powerSource: {
498
+ status: PowerSource.PowerSourceStatus.Active,
499
+ order: 0,
500
+ description: 'AC Power',
501
+ endpointList: [EndpointNumber(0)],
502
+ wiredCurrentType: PowerSource.WiredCurrentType.Ac,
503
+ },
504
+ timeSynchronization: {
505
+ utcTime: null,
506
+ granularity: TimeSynchronization.Granularity.NoTimeGranularity,
507
+ timeSource: TimeSynchronization.TimeSource.None,
508
+ trustedTimeSource: null,
509
+ defaultNtp: null,
510
+ supportsDnsResolve: false,
511
+ timeZone: [{ offset: 0, validAt: MATTER_EPOCH_US }],
512
+ dstOffset: [],
513
+ localTime: null,
514
+ timeZoneDatabase: TimeSynchronization.TimeZoneDatabase.None,
515
+ timeZoneListMaxSize: 2,
516
+ dstOffsetListMaxSize: 2,
517
+ },
518
+ tlsCertificateManagement: {
519
+ maxRootCertificates: 5,
520
+ provisionedRootCertificates: [],
521
+ maxClientCertificates: 5,
522
+ provisionedClientCertificates: [],
523
+ },
524
+ tlsClientManagement: {
525
+ maxProvisioned: 5,
526
+ provisionedEndpoints: [],
527
+ },
528
+ };
529
+ }