matterbridge 3.0.0-edge.2 → 3.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.
@@ -1,10 +1,10 @@
1
1
  import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
2
2
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
3
3
  import { isValidNumber, isValidObject } from './utils/export.js';
4
- import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeRvcRunModeServer, MatterbridgeRvcCleanModeServer, MatterbridgeRvcOperationalStateServer, } from './matterbridgeBehaviors.js';
4
+ import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
5
5
  import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
6
6
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
7
- import { ClusterType, getClusterNameById, MeasurementType } from '@matter/main/types';
7
+ import { getClusterNameById, MeasurementType } from '@matter/main/types';
8
8
  import { Descriptor } from '@matter/main/clusters/descriptor';
9
9
  import { PowerSource } from '@matter/main/clusters/power-source';
10
10
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
@@ -26,8 +26,6 @@ import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-pow
26
26
  import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-energy-measurement';
27
27
  import { AirQuality } from '@matter/main/clusters/air-quality';
28
28
  import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
29
- import { RvcRunMode } from '@matter/main/clusters/rvc-run-mode';
30
- import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
31
29
  import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
32
30
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
33
31
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
@@ -57,7 +55,6 @@ import { Pm25ConcentrationMeasurementServer } from '@matter/main/behaviors/pm25-
57
55
  import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-concentration-measurement';
58
56
  import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
59
57
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
60
- import { RvcCleanMode } from '@matter/main/clusters/rvc-clean-mode';
61
58
  export class MatterbridgeEndpoint extends Endpoint {
62
59
  static bridgeMode = '';
63
60
  static logLevel = "info";
@@ -137,7 +134,7 @@ export class MatterbridgeEndpoint extends Endpoint {
137
134
  this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
138
135
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
139
136
  `id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
140
- this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
137
+ this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
141
138
  }
142
139
  static async loadInstance(definition, options = {}, debug = false) {
143
140
  return new MatterbridgeEndpoint(definition, options, debug);
@@ -522,7 +519,7 @@ export class MatterbridgeEndpoint extends Endpoint {
522
519
  return this;
523
520
  }
524
521
  createOnOffClusterServer(onOff = false) {
525
- this.behaviors.require(MatterbridgeOnOffServer.for(ClusterType(OnOff.Base)), {
522
+ this.behaviors.require(MatterbridgeOnOffServer, {
526
523
  onOff,
527
524
  });
528
525
  return this;
@@ -548,6 +545,17 @@ export class MatterbridgeEndpoint extends Endpoint {
548
545
  });
549
546
  return this;
550
547
  }
548
+ createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
549
+ this.behaviors.require(MatterbridgeLevelControlServer, {
550
+ currentLevel,
551
+ onLevel,
552
+ options: {
553
+ executeIfOff: false,
554
+ coupleColorTempToLevel: false,
555
+ },
556
+ });
557
+ return this;
558
+ }
551
559
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
552
560
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
553
561
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1154,48 +1162,4 @@ export class MatterbridgeEndpoint extends Endpoint {
1154
1162
  });
1155
1163
  return this;
1156
1164
  }
1157
- createDefaultRvcRunModeClusterServer() {
1158
- this.behaviors.require(MatterbridgeRvcRunModeServer.with(RvcRunMode.Feature.OnOff), {
1159
- supportedModes: [
1160
- { label: 'Idle', mode: 1, modeTags: [{ value: RvcRunMode.ModeTag.Idle }] },
1161
- { label: 'Cleaning', mode: 2, modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }] },
1162
- { label: 'SpotCleaning', mode: 3, modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }] },
1163
- ],
1164
- currentMode: 1,
1165
- startUpMode: null,
1166
- onMode: null,
1167
- });
1168
- return this;
1169
- }
1170
- createDefaultRvcCleanModeClusterServer() {
1171
- this.behaviors.require(MatterbridgeRvcCleanModeServer.with(RvcCleanMode.Feature.OnOff), {
1172
- supportedModes: [
1173
- { label: 'Vacuum', mode: 1, modeTags: [{ value: RvcCleanMode.ModeTag.Vacuum }] },
1174
- { label: 'Mop', mode: 2, modeTags: [{ value: RvcCleanMode.ModeTag.Mop }] },
1175
- { label: 'Clean', mode: 3, modeTags: [{ value: RvcCleanMode.ModeTag.DeepClean }] },
1176
- ],
1177
- currentMode: 1,
1178
- startUpMode: null,
1179
- onMode: null,
1180
- });
1181
- return this;
1182
- }
1183
- createDefaultRvcOperationalStateClusterServer() {
1184
- this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
1185
- phaseList: [],
1186
- currentPhase: null,
1187
- operationalStateList: [
1188
- { operationalStateId: RvcOperationalState.OperationalState.Stopped, operationalStateLabel: 'Stopped' },
1189
- { operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
1190
- { operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
1191
- { operationalStateId: RvcOperationalState.OperationalState.Error, operationalStateLabel: 'Error' },
1192
- { operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
1193
- { operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
1194
- { operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
1195
- ],
1196
- operationalState: RvcOperationalState.OperationalState.Docked,
1197
- operationalError: { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operative' },
1198
- });
1199
- return this;
1200
- }
1201
1165
  }
@@ -115,8 +115,8 @@ export class MatterbridgePlatform {
115
115
  if (device.deviceName)
116
116
  this._registeredEndpointsByName.delete(device.deviceName);
117
117
  }
118
- async unregisterAllDevices() {
119
- await this.matterbridge.removeAllBridgedEndpoints(this.name);
118
+ async unregisterAllDevices(delay = 0) {
119
+ await this.matterbridge.removeAllBridgedEndpoints(this.name, delay);
120
120
  this._registeredEndpoints.clear();
121
121
  this._registeredEndpointsByName.clear();
122
122
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.ea7910e9.css",
4
- "main.js": "./static/js/main.fe57dcc8.js",
4
+ "main.js": "./static/js/main.e11d6bb4.js",
5
5
  "static/js/453.d855a71b.chunk.js": "./static/js/453.d855a71b.chunk.js",
6
6
  "static/media/roboto-latin-700-normal.woff2": "./static/media/roboto-latin-700-normal.c4d6cab43bec89049809.woff2",
7
7
  "static/media/roboto-latin-500-normal.woff2": "./static/media/roboto-latin-500-normal.599f66a60bdf974e578e.woff2",
@@ -77,11 +77,11 @@
77
77
  "static/media/roboto-greek-ext-300-normal.woff": "./static/media/roboto-greek-ext-300-normal.60729cafbded24073dfb.woff",
78
78
  "index.html": "./index.html",
79
79
  "main.ea7910e9.css.map": "./static/css/main.ea7910e9.css.map",
80
- "main.fe57dcc8.js.map": "./static/js/main.fe57dcc8.js.map",
80
+ "main.e11d6bb4.js.map": "./static/js/main.e11d6bb4.js.map",
81
81
  "453.d855a71b.chunk.js.map": "./static/js/453.d855a71b.chunk.js.map"
82
82
  },
83
83
  "entrypoints": [
84
84
  "static/css/main.ea7910e9.css",
85
- "static/js/main.fe57dcc8.js"
85
+ "static/js/main.e11d6bb4.js"
86
86
  ]
87
87
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.fe57dcc8.js"></script><link href="./static/css/main.ea7910e9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.e11d6bb4.js"></script><link href="./static/css/main.ea7910e9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>