matterbridge 3.3.4-dev-20251020-4d2dd49 → 3.3.4-dev-20251021-7651f57
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 +9 -0
- package/README-DOCKER.md +4 -1
- package/README-SERVICE.md +4 -3
- package/dist/cli.js +7 -6
- package/dist/devices/airConditioner.js +2 -2
- package/dist/devices/batteryStorage.js +3 -3
- package/dist/devices/dishwasher.js +4 -4
- package/dist/devices/evse.js +6 -5
- package/dist/devices/extractorHood.js +1 -1
- package/dist/devices/heatPump.js +2 -2
- package/dist/devices/laundryDryer.js +3 -3
- package/dist/devices/laundryWasher.js +5 -5
- package/dist/devices/microwaveOven.js +5 -5
- package/dist/devices/oven.js +5 -5
- package/dist/devices/refrigerator.js +4 -4
- package/dist/devices/roboticVacuumCleaner.js +11 -11
- package/dist/devices/solarPower.js +2 -2
- package/dist/devices/speaker.js +2 -1
- package/dist/devices/temperatureControl.js +2 -2
- package/dist/devices/waterHeater.js +6 -6
- package/dist/frontend.js +27 -26
- package/dist/helpers.js +1 -1
- package/dist/matterbridge.js +46 -13
- package/dist/matterbridgeAccessoryPlatform.js +2 -0
- package/dist/matterbridgeBehaviors.js +39 -20
- package/dist/matterbridgeDeviceTypes.js +88 -86
- package/dist/matterbridgeDynamicPlatform.js +2 -0
- package/dist/matterbridgeEndpoint.js +92 -154
- package/dist/matterbridgeEndpointHelpers.js +221 -137
- package/dist/matterbridgePlatform.js +2 -2
- package/dist/update.js +1 -1
- package/dist/utils/format.js +29 -0
- package/dist/utils/jestHelpers.js +7 -3
- package/dist/utils/network.js +0 -26
- package/dist/utils/tracker.js +17 -45
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Behavior } from '@matter/
|
|
1
|
+
import { Behavior } from '@matter/node';
|
|
2
2
|
import { BooleanStateConfiguration } from '@matter/types/clusters/boolean-state-configuration';
|
|
3
3
|
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
4
4
|
import { FanControl } from '@matter/types/clusters/fan-control';
|
|
@@ -12,25 +12,26 @@ import { ServiceArea } from '@matter/types/clusters/service-area';
|
|
|
12
12
|
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
13
13
|
import { ResourceMonitoring } from '@matter/types/clusters/resource-monitoring';
|
|
14
14
|
import { DeviceEnergyManagementMode } from '@matter/types/clusters/device-energy-management-mode';
|
|
15
|
-
import { IdentifyServer } from '@matter/
|
|
16
|
-
import { OnOffServer } from '@matter/
|
|
17
|
-
import { LevelControlServer } from '@matter/
|
|
18
|
-
import { ColorControlServer } from '@matter/
|
|
19
|
-
import { WindowCoveringServer } from '@matter/
|
|
20
|
-
import { BooleanStateConfigurationServer } from '@matter/
|
|
21
|
-
import { DoorLockServer } from '@matter/
|
|
22
|
-
import { FanControlServer } from '@matter/
|
|
23
|
-
import { ThermostatServer } from '@matter/
|
|
24
|
-
import { ValveConfigurationAndControlServer } from '@matter/
|
|
25
|
-
import { ModeSelectServer } from '@matter/
|
|
26
|
-
import { SmokeCoAlarmServer } from '@matter/
|
|
27
|
-
import { SwitchServer } from '@matter/
|
|
28
|
-
import { OperationalStateServer } from '@matter/
|
|
29
|
-
import { ServiceAreaServer } from '@matter/
|
|
30
|
-
import { DeviceEnergyManagementServer } from '@matter/
|
|
31
|
-
import { DeviceEnergyManagementModeServer } from '@matter/
|
|
32
|
-
import { HepaFilterMonitoringServer } from '@matter/
|
|
33
|
-
import { ActivatedCarbonFilterMonitoringServer } from '@matter/
|
|
15
|
+
import { IdentifyServer } from '@matter/node/behaviors/identify';
|
|
16
|
+
import { OnOffServer } from '@matter/node/behaviors/on-off';
|
|
17
|
+
import { LevelControlServer } from '@matter/node/behaviors/level-control';
|
|
18
|
+
import { ColorControlServer } from '@matter/node/behaviors/color-control';
|
|
19
|
+
import { WindowCoveringServer } from '@matter/node/behaviors/window-covering';
|
|
20
|
+
import { BooleanStateConfigurationServer } from '@matter/node/behaviors/boolean-state-configuration';
|
|
21
|
+
import { DoorLockServer } from '@matter/node/behaviors/door-lock';
|
|
22
|
+
import { FanControlServer } from '@matter/node/behaviors/fan-control';
|
|
23
|
+
import { ThermostatServer } from '@matter/node/behaviors/thermostat';
|
|
24
|
+
import { ValveConfigurationAndControlServer } from '@matter/node/behaviors/valve-configuration-and-control';
|
|
25
|
+
import { ModeSelectServer } from '@matter/node/behaviors/mode-select';
|
|
26
|
+
import { SmokeCoAlarmServer } from '@matter/node/behaviors/smoke-co-alarm';
|
|
27
|
+
import { SwitchServer } from '@matter/node/behaviors/switch';
|
|
28
|
+
import { OperationalStateServer } from '@matter/node/behaviors/operational-state';
|
|
29
|
+
import { ServiceAreaServer } from '@matter/node/behaviors/service-area';
|
|
30
|
+
import { DeviceEnergyManagementServer } from '@matter/node/behaviors/device-energy-management';
|
|
31
|
+
import { DeviceEnergyManagementModeServer } from '@matter/node/behaviors/device-energy-management-mode';
|
|
32
|
+
import { HepaFilterMonitoringServer } from '@matter/node/behaviors/hepa-filter-monitoring';
|
|
33
|
+
import { ActivatedCarbonFilterMonitoringServer } from '@matter/node/behaviors/activated-carbon-filter-monitoring';
|
|
34
|
+
import { PowerSourceServer } from '@matter/node/behaviors/power-source';
|
|
34
35
|
export class MatterbridgeServer extends Behavior {
|
|
35
36
|
static id = 'matterbridge';
|
|
36
37
|
initialize() {
|
|
@@ -45,6 +46,24 @@ export class MatterbridgeServer extends Behavior {
|
|
|
45
46
|
}
|
|
46
47
|
MatterbridgeServer.State = State;
|
|
47
48
|
})(MatterbridgeServer || (MatterbridgeServer = {}));
|
|
49
|
+
export class MatterbridgePowerSourceServer extends PowerSourceServer {
|
|
50
|
+
initialize() {
|
|
51
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
52
|
+
device.log.info(`Initializing MatterbridgePowerSourceServer (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
53
|
+
this.state.endpointList = [this.endpoint.number];
|
|
54
|
+
this.endpoint.construction.onSuccess(() => {
|
|
55
|
+
device.log.debug(`MatterbridgePowerSourceServer: endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber} construction completed`);
|
|
56
|
+
const endpointList = [this.endpoint.number];
|
|
57
|
+
for (const endpoint of this.endpoint.parts) {
|
|
58
|
+
if (endpoint.lifecycle.isReady) {
|
|
59
|
+
endpointList.push(endpoint.number);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.endpoint.setStateOf(PowerSourceServer, { endpointList });
|
|
63
|
+
device.log.debug(`MatterbridgePowerSourceServer: endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber} construction completed with endpointList: ${endpointList.join(', ')}`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
48
67
|
export class MatterbridgeIdentifyServer extends IdentifyServer {
|
|
49
68
|
identify(request) {
|
|
50
69
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -1,88 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
1
|
+
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
+
console.log('\u001B[32mMatterbridgeDeviceTypes loaded.\u001B[40;0m');
|
|
3
|
+
import { DeviceTypeId } from '@matter/types/datatype';
|
|
4
|
+
import { AccountLogin } from '@matter/types/clusters/account-login';
|
|
5
|
+
import { Actions } from '@matter/types/clusters/actions';
|
|
6
|
+
import { ActivatedCarbonFilterMonitoring } from '@matter/types/clusters/activated-carbon-filter-monitoring';
|
|
7
|
+
import { AdministratorCommissioning } from '@matter/types/clusters/administrator-commissioning';
|
|
8
|
+
import { AirQuality } from '@matter/types/clusters/air-quality';
|
|
9
|
+
import { ApplicationLauncher } from '@matter/types/clusters/application-launcher';
|
|
10
|
+
import { AudioOutput } from '@matter/types/clusters/audio-output';
|
|
11
|
+
import { BooleanState } from '@matter/types/clusters/boolean-state';
|
|
12
|
+
import { BooleanStateConfiguration } from '@matter/types/clusters/boolean-state-configuration';
|
|
13
|
+
import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
|
|
14
|
+
import { CarbonDioxideConcentrationMeasurement } from '@matter/types/clusters/carbon-dioxide-concentration-measurement';
|
|
15
|
+
import { CarbonMonoxideConcentrationMeasurement } from '@matter/types/clusters/carbon-monoxide-concentration-measurement';
|
|
16
|
+
import { Channel } from '@matter/types/clusters/channel';
|
|
17
|
+
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
18
|
+
import { CommissionerControl } from '@matter/types/clusters/commissioner-control';
|
|
19
|
+
import { ContentControl } from '@matter/types/clusters/content-control';
|
|
20
|
+
import { ContentLauncher } from '@matter/types/clusters/content-launcher';
|
|
21
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
22
|
+
import { DeviceEnergyManagementMode } from '@matter/types/clusters/device-energy-management-mode';
|
|
23
|
+
import { DishwasherAlarm } from '@matter/types/clusters/dishwasher-alarm';
|
|
24
|
+
import { DishwasherMode } from '@matter/types/clusters/dishwasher-mode';
|
|
25
|
+
import { DoorLock } from '@matter/types/clusters/door-lock';
|
|
26
|
+
import { EcosystemInformation } from '@matter/types/clusters/ecosystem-information';
|
|
27
|
+
import { ElectricalEnergyMeasurement } from '@matter/types/clusters/electrical-energy-measurement';
|
|
28
|
+
import { ElectricalPowerMeasurement } from '@matter/types/clusters/electrical-power-measurement';
|
|
29
|
+
import { EnergyEvse } from '@matter/types/clusters/energy-evse';
|
|
30
|
+
import { EnergyEvseMode } from '@matter/types/clusters/energy-evse-mode';
|
|
31
|
+
import { EnergyPreference } from '@matter/types/clusters/energy-preference';
|
|
32
|
+
import { FanControl } from '@matter/types/clusters/fan-control';
|
|
33
|
+
import { FlowMeasurement } from '@matter/types/clusters/flow-measurement';
|
|
34
|
+
import { FormaldehydeConcentrationMeasurement } from '@matter/types/clusters/formaldehyde-concentration-measurement';
|
|
35
|
+
import { Groups } from '@matter/types/clusters/groups';
|
|
36
|
+
import { HepaFilterMonitoring } from '@matter/types/clusters/hepa-filter-monitoring';
|
|
37
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
38
|
+
import { IlluminanceMeasurement } from '@matter/types/clusters/illuminance-measurement';
|
|
39
|
+
import { KeypadInput } from '@matter/types/clusters/keypad-input';
|
|
40
|
+
import { LaundryDryerControls } from '@matter/types/clusters/laundry-dryer-controls';
|
|
41
|
+
import { LaundryWasherControls } from '@matter/types/clusters/laundry-washer-controls';
|
|
42
|
+
import { LaundryWasherMode } from '@matter/types/clusters/laundry-washer-mode';
|
|
43
|
+
import { LevelControl } from '@matter/types/clusters/level-control';
|
|
44
|
+
import { LowPower } from '@matter/types/clusters/low-power';
|
|
45
|
+
import { MediaInput } from '@matter/types/clusters/media-input';
|
|
46
|
+
import { MediaPlayback } from '@matter/types/clusters/media-playback';
|
|
47
|
+
import { Messages } from '@matter/types/clusters/messages';
|
|
48
|
+
import { MicrowaveOvenControl } from '@matter/types/clusters/microwave-oven-control';
|
|
49
|
+
import { MicrowaveOvenMode } from '@matter/types/clusters/microwave-oven-mode';
|
|
50
|
+
import { ModeSelect } from '@matter/types/clusters/mode-select';
|
|
51
|
+
import { NitrogenDioxideConcentrationMeasurement } from '@matter/types/clusters/nitrogen-dioxide-concentration-measurement';
|
|
52
|
+
import { OccupancySensing } from '@matter/types/clusters/occupancy-sensing';
|
|
53
|
+
import { OnOff } from '@matter/types/clusters/on-off';
|
|
54
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
55
|
+
import { OtaSoftwareUpdateProvider } from '@matter/types/clusters/ota-software-update-provider';
|
|
56
|
+
import { OtaSoftwareUpdateRequestor } from '@matter/types/clusters/ota-software-update-requestor';
|
|
57
|
+
import { OvenCavityOperationalState } from '@matter/types/clusters/oven-cavity-operational-state';
|
|
58
|
+
import { OvenMode } from '@matter/types/clusters/oven-mode';
|
|
59
|
+
import { OzoneConcentrationMeasurement } from '@matter/types/clusters/ozone-concentration-measurement';
|
|
60
|
+
import { Pm1ConcentrationMeasurement } from '@matter/types/clusters/pm1-concentration-measurement';
|
|
61
|
+
import { Pm10ConcentrationMeasurement } from '@matter/types/clusters/pm10-concentration-measurement';
|
|
62
|
+
import { Pm25ConcentrationMeasurement } from '@matter/types/clusters/pm25-concentration-measurement';
|
|
63
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
64
|
+
import { PowerTopology } from '@matter/types/clusters/power-topology';
|
|
65
|
+
import { PressureMeasurement } from '@matter/types/clusters/pressure-measurement';
|
|
66
|
+
import { PumpConfigurationAndControl } from '@matter/types/clusters/pump-configuration-and-control';
|
|
67
|
+
import { RadonConcentrationMeasurement } from '@matter/types/clusters/radon-concentration-measurement';
|
|
68
|
+
import { RefrigeratorAlarm } from '@matter/types/clusters/refrigerator-alarm';
|
|
69
|
+
import { RefrigeratorAndTemperatureControlledCabinetMode } from '@matter/types/clusters/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
70
|
+
import { RelativeHumidityMeasurement } from '@matter/types/clusters/relative-humidity-measurement';
|
|
71
|
+
import { RvcCleanMode } from '@matter/types/clusters/rvc-clean-mode';
|
|
72
|
+
import { RvcOperationalState } from '@matter/types/clusters/rvc-operational-state';
|
|
73
|
+
import { RvcRunMode } from '@matter/types/clusters/rvc-run-mode';
|
|
74
|
+
import { ServiceArea } from '@matter/types/clusters/service-area';
|
|
75
|
+
import { SmokeCoAlarm } from '@matter/types/clusters/smoke-co-alarm';
|
|
76
|
+
import { Switch } from '@matter/types/clusters/switch';
|
|
77
|
+
import { TargetNavigator } from '@matter/types/clusters/target-navigator';
|
|
78
|
+
import { TemperatureControl } from '@matter/types/clusters/temperature-control';
|
|
79
|
+
import { TemperatureMeasurement } from '@matter/types/clusters/temperature-measurement';
|
|
80
|
+
import { Thermostat } from '@matter/types/clusters/thermostat';
|
|
81
|
+
import { ThermostatUserInterfaceConfiguration } from '@matter/types/clusters/thermostat-user-interface-configuration';
|
|
82
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/types/clusters/total-volatile-organic-compounds-concentration-measurement';
|
|
83
|
+
import { ValveConfigurationAndControl } from '@matter/types/clusters/valve-configuration-and-control';
|
|
84
|
+
import { WakeOnLan } from '@matter/types/clusters/wake-on-lan';
|
|
85
|
+
import { WaterHeaterManagement } from '@matter/types/clusters/water-heater-management';
|
|
86
|
+
import { WaterHeaterMode } from '@matter/types/clusters/water-heater-mode';
|
|
87
|
+
import { WindowCovering } from '@matter/types/clusters/window-covering';
|
|
86
88
|
export var DeviceClasses;
|
|
87
89
|
(function (DeviceClasses) {
|
|
88
90
|
DeviceClasses["Node"] = "Node";
|
|
@@ -90,9 +92,9 @@ export var DeviceClasses;
|
|
|
90
92
|
DeviceClasses["Utility"] = "Utility";
|
|
91
93
|
DeviceClasses["Simple"] = "Simple";
|
|
92
94
|
DeviceClasses["Dynamic"] = "Dynamic";
|
|
95
|
+
DeviceClasses["Composed"] = "Composed";
|
|
93
96
|
DeviceClasses["Client"] = "Client";
|
|
94
97
|
DeviceClasses["Server"] = "Server";
|
|
95
|
-
DeviceClasses["Composed"] = "Composed";
|
|
96
98
|
DeviceClasses["Duplicate"] = "Duplicate";
|
|
97
99
|
DeviceClasses["BridgedPowerSourceInfo"] = "BridgedPowerSourceInfo";
|
|
98
100
|
})(DeviceClasses || (DeviceClasses = {}));
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
+
console.log('\u001B[32mMatterbridgeDynamicPlatform loaded.\u001B[40;0m');
|
|
1
3
|
import { MatterbridgePlatform } from './matterbridgePlatform.js';
|
|
2
4
|
export class MatterbridgeDynamicPlatform extends MatterbridgePlatform {
|
|
3
5
|
constructor(matterbridge, log, config) {
|
|
@@ -1,66 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
1
|
+
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
+
console.log('\u001B[32mMatterbridgeEndpoint loaded.\u001B[40;0m');
|
|
3
|
+
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from 'node-ansi-logger';
|
|
4
|
+
import { Lifecycle, NamedHandler, UINT16_MAX, UINT32_MAX } from '@matter/general';
|
|
5
|
+
import { Endpoint, MutableEndpoint, SupportedBehaviors } from '@matter/node';
|
|
6
|
+
import { getClusterNameById } from '@matter/types/cluster';
|
|
7
|
+
import { VendorId } from '@matter/types/datatype';
|
|
8
|
+
import { Descriptor } from '@matter/types/clusters/descriptor';
|
|
9
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
10
|
+
import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
|
|
11
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
12
|
+
import { OnOff } from '@matter/types/clusters/on-off';
|
|
13
|
+
import { LevelControl } from '@matter/types/clusters/level-control';
|
|
14
|
+
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
15
|
+
import { WindowCovering } from '@matter/types/clusters/window-covering';
|
|
16
|
+
import { Thermostat } from '@matter/types/clusters/thermostat';
|
|
17
|
+
import { FanControl } from '@matter/types/clusters/fan-control';
|
|
18
|
+
import { DoorLock } from '@matter/types/clusters/door-lock';
|
|
19
|
+
import { ValveConfigurationAndControl } from '@matter/types/clusters/valve-configuration-and-control';
|
|
20
|
+
import { PumpConfigurationAndControl } from '@matter/types/clusters/pump-configuration-and-control';
|
|
21
|
+
import { SmokeCoAlarm } from '@matter/types/clusters/smoke-co-alarm';
|
|
22
|
+
import { Switch } from '@matter/types/clusters/switch';
|
|
23
|
+
import { BooleanStateConfiguration } from '@matter/types/clusters/boolean-state-configuration';
|
|
24
|
+
import { PowerTopology } from '@matter/types/clusters/power-topology';
|
|
25
|
+
import { ElectricalPowerMeasurement } from '@matter/types/clusters/electrical-power-measurement';
|
|
26
|
+
import { ElectricalEnergyMeasurement } from '@matter/types/clusters/electrical-energy-measurement';
|
|
27
|
+
import { AirQuality } from '@matter/types/clusters/air-quality';
|
|
28
|
+
import { ConcentrationMeasurement } from '@matter/types/clusters/concentration-measurement';
|
|
29
|
+
import { OccupancySensing } from '@matter/types/clusters/occupancy-sensing';
|
|
30
|
+
import { ThermostatUserInterfaceConfiguration } from '@matter/types/clusters/thermostat-user-interface-configuration';
|
|
31
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
32
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
33
|
+
import { ResourceMonitoring } from '@matter/types/clusters/resource-monitoring';
|
|
34
|
+
import { DescriptorServer } from '@matter/node/behaviors/descriptor';
|
|
35
|
+
import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
|
|
36
|
+
import { GroupsServer } from '@matter/node/behaviors/groups';
|
|
37
|
+
import { ScenesManagementServer } from '@matter/node/behaviors/scenes-management';
|
|
38
|
+
import { PumpConfigurationAndControlServer } from '@matter/node/behaviors/pump-configuration-and-control';
|
|
39
|
+
import { SwitchServer } from '@matter/node/behaviors/switch';
|
|
40
|
+
import { BooleanStateServer } from '@matter/node/behaviors/boolean-state';
|
|
41
|
+
import { PowerTopologyServer } from '@matter/node/behaviors/power-topology';
|
|
42
|
+
import { ElectricalPowerMeasurementServer } from '@matter/node/behaviors/electrical-power-measurement';
|
|
43
|
+
import { ElectricalEnergyMeasurementServer } from '@matter/node/behaviors/electrical-energy-measurement';
|
|
44
|
+
import { TemperatureMeasurementServer } from '@matter/node/behaviors/temperature-measurement';
|
|
45
|
+
import { RelativeHumidityMeasurementServer } from '@matter/node/behaviors/relative-humidity-measurement';
|
|
46
|
+
import { PressureMeasurementServer } from '@matter/node/behaviors/pressure-measurement';
|
|
47
|
+
import { FlowMeasurementServer } from '@matter/node/behaviors/flow-measurement';
|
|
48
|
+
import { IlluminanceMeasurementServer } from '@matter/node/behaviors/illuminance-measurement';
|
|
49
|
+
import { OccupancySensingServer } from '@matter/node/behaviors/occupancy-sensing';
|
|
50
|
+
import { AirQualityServer } from '@matter/node/behaviors/air-quality';
|
|
51
|
+
import { CarbonMonoxideConcentrationMeasurementServer } from '@matter/node/behaviors/carbon-monoxide-concentration-measurement';
|
|
52
|
+
import { CarbonDioxideConcentrationMeasurementServer } from '@matter/node/behaviors/carbon-dioxide-concentration-measurement';
|
|
53
|
+
import { NitrogenDioxideConcentrationMeasurementServer } from '@matter/node/behaviors/nitrogen-dioxide-concentration-measurement';
|
|
54
|
+
import { OzoneConcentrationMeasurementServer } from '@matter/node/behaviors/ozone-concentration-measurement';
|
|
55
|
+
import { FormaldehydeConcentrationMeasurementServer } from '@matter/node/behaviors/formaldehyde-concentration-measurement';
|
|
56
|
+
import { Pm1ConcentrationMeasurementServer } from '@matter/node/behaviors/pm1-concentration-measurement';
|
|
57
|
+
import { Pm25ConcentrationMeasurementServer } from '@matter/node/behaviors/pm25-concentration-measurement';
|
|
58
|
+
import { Pm10ConcentrationMeasurementServer } from '@matter/node/behaviors/pm10-concentration-measurement';
|
|
59
|
+
import { RadonConcentrationMeasurementServer } from '@matter/node/behaviors/radon-concentration-measurement';
|
|
60
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/node/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
61
|
+
import { FanControlServer } from '@matter/node/behaviors/fan-control';
|
|
62
|
+
import { ThermostatUserInterfaceConfigurationServer } from '@matter/node/behaviors/thermostat-user-interface-configuration';
|
|
63
|
+
import { isValidNumber, isValidObject, isValidString } from './utils/isvalid.js';
|
|
64
|
+
import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, MatterbridgeActivatedCarbonFilterMonitoringServer, MatterbridgeHepaFilterMonitoringServer, MatterbridgeEnhancedColorControlServer, MatterbridgePowerSourceServer, } from './matterbridgeBehaviors.js';
|
|
65
|
+
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, getDefaultElectricalEnergyMeasurementClusterServer, getDefaultElectricalPowerMeasurementClusterServer, getApparentElectricalPowerMeasurementClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, featuresFor, getDefaultPowerSourceWiredClusterServer, getDefaultPowerSourceReplaceableBatteryClusterServer, getDefaultPowerSourceRechargeableBatteryClusterServer, getDefaultDeviceEnergyManagementClusterServer, getDefaultDeviceEnergyManagementModeClusterServer, } from './matterbridgeEndpointHelpers.js';
|
|
64
66
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
65
67
|
static logLevel = "info";
|
|
66
68
|
mode = undefined;
|
|
@@ -403,49 +405,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
403
405
|
return device;
|
|
404
406
|
}
|
|
405
407
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
406
|
-
this.behaviors.require(
|
|
407
|
-
status: PowerSource.PowerSourceStatus.Active,
|
|
408
|
-
order: 0,
|
|
409
|
-
description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
|
|
410
|
-
endpointList: [],
|
|
411
|
-
wiredCurrentType,
|
|
412
|
-
});
|
|
408
|
+
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Wired), getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
413
409
|
return this;
|
|
414
410
|
}
|
|
415
411
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
|
|
416
|
-
this.behaviors.require(
|
|
417
|
-
status: PowerSource.PowerSourceStatus.Active,
|
|
418
|
-
order: 0,
|
|
419
|
-
description: 'Primary battery',
|
|
420
|
-
endpointList: [],
|
|
421
|
-
batVoltage,
|
|
422
|
-
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
423
|
-
batChargeLevel,
|
|
424
|
-
batReplacementNeeded: false,
|
|
425
|
-
batReplaceability,
|
|
426
|
-
activeBatFaults: undefined,
|
|
427
|
-
batReplacementDescription,
|
|
428
|
-
batQuantity,
|
|
429
|
-
});
|
|
412
|
+
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity, batReplaceability));
|
|
430
413
|
return this;
|
|
431
414
|
}
|
|
432
415
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
|
|
433
|
-
this.behaviors.require(
|
|
434
|
-
status: PowerSource.PowerSourceStatus.Active,
|
|
435
|
-
order: 0,
|
|
436
|
-
description: 'Primary battery',
|
|
437
|
-
endpointList: [],
|
|
438
|
-
batVoltage,
|
|
439
|
-
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
440
|
-
batTimeRemaining: null,
|
|
441
|
-
batChargeLevel,
|
|
442
|
-
batReplacementNeeded: false,
|
|
443
|
-
batReplaceability,
|
|
444
|
-
batPresent: true,
|
|
445
|
-
activeBatFaults: [],
|
|
446
|
-
batChargeState: PowerSource.BatChargeState.IsNotCharging,
|
|
447
|
-
batFunctionalWhileCharging: true,
|
|
448
|
-
});
|
|
416
|
+
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplaceability));
|
|
449
417
|
return this;
|
|
450
418
|
}
|
|
451
419
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
@@ -495,6 +463,30 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
495
463
|
});
|
|
496
464
|
return this;
|
|
497
465
|
}
|
|
466
|
+
createDefaultPowerTopologyClusterServer() {
|
|
467
|
+
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
468
|
+
return this;
|
|
469
|
+
}
|
|
470
|
+
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
471
|
+
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), getDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported));
|
|
472
|
+
return this;
|
|
473
|
+
}
|
|
474
|
+
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
475
|
+
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), getDefaultElectricalPowerMeasurementClusterServer(voltage, current, power, frequency));
|
|
476
|
+
return this;
|
|
477
|
+
}
|
|
478
|
+
createApparentElectricalPowerMeasurementClusterServer(voltage = null, apparentCurrent = null, apparentPower = null, frequency = null) {
|
|
479
|
+
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), getApparentElectricalPowerMeasurementClusterServer(voltage, apparentCurrent, apparentPower, frequency));
|
|
480
|
+
return this;
|
|
481
|
+
}
|
|
482
|
+
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
483
|
+
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), getDefaultDeviceEnergyManagementClusterServer(esaType, esaCanGenerate, esaState, absMinPower, absMaxPower));
|
|
484
|
+
return this;
|
|
485
|
+
}
|
|
486
|
+
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
487
|
+
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, getDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes));
|
|
488
|
+
return this;
|
|
489
|
+
}
|
|
498
490
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
499
491
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
500
492
|
identifyTime,
|
|
@@ -1155,60 +1147,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1155
1147
|
});
|
|
1156
1148
|
return this;
|
|
1157
1149
|
}
|
|
1158
|
-
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1159
|
-
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
|
|
1160
|
-
esaType,
|
|
1161
|
-
esaCanGenerate,
|
|
1162
|
-
esaState,
|
|
1163
|
-
absMinPower,
|
|
1164
|
-
absMaxPower,
|
|
1165
|
-
powerAdjustmentCapability: null,
|
|
1166
|
-
optOutState: DeviceEnergyManagement.OptOutState.NoOptOut,
|
|
1167
|
-
forecast: null,
|
|
1168
|
-
});
|
|
1169
|
-
return this;
|
|
1170
|
-
}
|
|
1171
|
-
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1172
|
-
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
1173
|
-
supportedModes: supportedModes ?? [
|
|
1174
|
-
{ label: 'No Energy Management (Forecast reporting only)', mode: 1, modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.NoOptimization }] },
|
|
1175
|
-
{
|
|
1176
|
-
label: 'Device Energy Management',
|
|
1177
|
-
mode: 2,
|
|
1178
|
-
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }],
|
|
1179
|
-
},
|
|
1180
|
-
{
|
|
1181
|
-
label: 'Home Energy Management',
|
|
1182
|
-
mode: 3,
|
|
1183
|
-
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.GridOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }],
|
|
1184
|
-
},
|
|
1185
|
-
{ label: 'Grid Energy Managemen', mode: 4, modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.GridOptimization }] },
|
|
1186
|
-
{
|
|
1187
|
-
label: 'Full Energy Management',
|
|
1188
|
-
mode: 5,
|
|
1189
|
-
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
1190
|
-
},
|
|
1191
|
-
],
|
|
1192
|
-
currentMode: currentMode ?? 1,
|
|
1193
|
-
});
|
|
1194
|
-
return this;
|
|
1195
|
-
}
|
|
1196
|
-
createDefaultPowerTopologyClusterServer() {
|
|
1197
|
-
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1198
|
-
return this;
|
|
1199
|
-
}
|
|
1200
|
-
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
1201
|
-
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), getDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported));
|
|
1202
|
-
return this;
|
|
1203
|
-
}
|
|
1204
|
-
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1205
|
-
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), getDefaultElectricalPowerMeasurementClusterServer(voltage, current, power, frequency));
|
|
1206
|
-
return this;
|
|
1207
|
-
}
|
|
1208
|
-
createApparentElectricalPowerMeasurementClusterServer(voltage = null, apparentCurrent = null, apparentPower = null, frequency = null) {
|
|
1209
|
-
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), getApparentElectricalPowerMeasurementClusterServer(voltage, apparentCurrent, apparentPower, frequency));
|
|
1210
|
-
return this;
|
|
1211
|
-
}
|
|
1212
1150
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1213
1151
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1214
1152
|
return this;
|