matterbridge 3.2.3-dev-20250815-4335c74 → 3.2.3-dev-20250820-d283e3d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -4
- package/README-DEV.md +52 -1
- package/dist/devices/export.js +2 -1
- package/dist/devices/refrigerator.js +55 -0
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -12,10 +12,12 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
12
12
|
|
|
13
13
|
### Added
|
|
14
14
|
|
|
15
|
-
- [Oven]: Added Oven class and Jest test. It is not supported by the Home app.
|
|
16
|
-
- [MicrowaveOven]: Added MicrowaveOven class and Jest test. It is not supported by the Home app.
|
|
17
|
-
- [Cooktop]: Added Cooktop class and Jest test. It is not supported by the Home app.
|
|
18
|
-
- [
|
|
15
|
+
- [Oven]: Added Oven() class and Jest test. It is not supported by the Home app.
|
|
16
|
+
- [MicrowaveOven]: Added MicrowaveOven() class and Jest test. It is not supported by the Home app.
|
|
17
|
+
- [Cooktop]: Added Cooktop() class and Jest test. It is not supported by the Home app.
|
|
18
|
+
- [Refrigerator]: Added Refrigerator() class and Jest test. It is not supported by the Home app.
|
|
19
|
+
- [Pages]: Added first draft of https://luligu.github.io/matterbridge.
|
|
20
|
+
- [Matter]: Added Matter Specification Version 1.0, 1.1, 1.2, 1.3, 1.4 and 1.4.1 pdf files.
|
|
19
21
|
|
|
20
22
|
### Changed
|
|
21
23
|
|
package/README-DEV.md
CHANGED
|
@@ -357,6 +357,57 @@ The schema file is loaded from the root of the plugin package. The file must be
|
|
|
357
357
|
|
|
358
358
|
The properties of the schema file shall correspond to the properties of the config file.
|
|
359
359
|
|
|
360
|
+
# Frequently asked questions
|
|
361
|
+
|
|
362
|
+
## Why plugins cannot install matterbridge as a dependency, devDependency or peerDependency
|
|
363
|
+
|
|
364
|
+
There must be one and only one instance of Matterbridge and matter.js in the node_modules directory.
|
|
365
|
+
|
|
366
|
+
### What happens when matterbridge or matter.js are present like a devDependencies
|
|
367
|
+
|
|
368
|
+
The plugins can be globally installed in different ways:
|
|
369
|
+
|
|
370
|
+
- from npm (all devDependencies are installed in node_modules if the plugin is not correctly published)
|
|
371
|
+
- from a tarball (all devDependencies are installed in node_modules if the tarball is not correctly built)
|
|
372
|
+
- from a local path (devDependencies are always installed in node_modules!)
|
|
373
|
+
|
|
374
|
+
In all these cases the devDependencies are always installed by npm and show up in the plugins `node_modules`:
|
|
375
|
+
|
|
376
|
+
- npm install -g ./yourplugin
|
|
377
|
+
- npm install -g git+https://github.com/you/yourplugin.git
|
|
378
|
+
- npm install -g yourplugin
|
|
379
|
+
|
|
380
|
+
In the first 2 cases the devDependeincies are always installed in node_modules!
|
|
381
|
+
|
|
382
|
+
In the last (most dangerous case) they are installed when the user forgets to add --omit=dev or doesn't have NODE_ENV=production.
|
|
383
|
+
|
|
384
|
+
This is also the reason why to be safe 100% all official plugins are published for production removing also devDependencies from package.json.
|
|
385
|
+
|
|
386
|
+
I also lock the dependencies with npm shrinkwrap cause npm installs always the latest versions that mach your range in package.json but sometimes this just breaks the plugin. This permits to be sure that the user host machine has exactly the same dependencies you coded your plugin with.
|
|
387
|
+
|
|
388
|
+
### The technical reason we cannot have matterbridge or @matter in the plugin node_modules.
|
|
389
|
+
|
|
390
|
+
Module Resolution in Matterbridge Plugin System.
|
|
391
|
+
When Matterbridge loads plugins on demand as ESM modules, the module resolution follows Node.js's standard module resolution algorithm. Here's how it works:
|
|
392
|
+
|
|
393
|
+
**1. Plugin Loading Process**
|
|
394
|
+
From the code in pluginManager.ts (lines 628-632), Matterbridge:
|
|
395
|
+
|
|
396
|
+
Resolves the plugin's main entry point from its package.json
|
|
397
|
+
Converts the file path to a URL using pathToFileURL()
|
|
398
|
+
Uses dynamic import: await import(pluginUrl.href)
|
|
399
|
+
|
|
400
|
+
**2. Module Resolution Priority**
|
|
401
|
+
When the plugin code runs import statements, Node.js follows this resolution order:
|
|
402
|
+
|
|
403
|
+
Plugin's local node_modules - Checked first
|
|
404
|
+
Parent directories - Walks up the directory tree looking for node_modules
|
|
405
|
+
Matterbridge's node_modules - Only reached if not found in plugin's dependencies
|
|
406
|
+
|
|
407
|
+
**3. Key Behavior**
|
|
408
|
+
Plugin's node_modules takes precedence - If a package exists in the plugin's own node_modules, that version will be used.
|
|
409
|
+
Matterbridge's node_modules is used as fallback.
|
|
410
|
+
|
|
360
411
|
# Contribution Guidelines
|
|
361
412
|
|
|
362
413
|
Thank you for your interest in contributing to my project!
|
|
@@ -373,5 +424,5 @@ I warmly welcome contributions to this project! Whether it's reporting bugs, pro
|
|
|
373
424
|
|
|
374
425
|
- Create a new pull request against the dev from my repository and I'll be glad to check it out
|
|
375
426
|
- Be sure to follow the existing code style
|
|
376
|
-
- Add unit tests for any new or changed functionality if possible
|
|
427
|
+
- Add unit tests for any new or changed functionality if possible cause Matterbridge has a 100% test coverage.
|
|
377
428
|
- In your pull request, do describe what your changes do and how they work
|
package/dist/devices/export.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './roboticVacuumCleaner.js';
|
|
1
2
|
export * from './laundryWasher.js';
|
|
2
3
|
export * from './laundryDryer.js';
|
|
3
4
|
export * from './extractorHood.js';
|
|
@@ -5,9 +6,9 @@ export * from './dishwasher.js';
|
|
|
5
6
|
export * from './microwaveOven.js';
|
|
6
7
|
export * from './oven.js';
|
|
7
8
|
export * from './cooktop.js';
|
|
9
|
+
export * from './refrigerator.js';
|
|
8
10
|
export * from './waterHeater.js';
|
|
9
11
|
export * from './evse.js';
|
|
10
12
|
export * from './solarPower.js';
|
|
11
13
|
export * from './batteryStorage.js';
|
|
12
14
|
export * from './heatPump.js';
|
|
13
|
-
export * from './roboticVacuumCleaner.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
2
|
+
import { RefrigeratorAndTemperatureControlledCabinetModeServer } from '@matter/main/behaviors/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
3
|
+
import { RefrigeratorAndTemperatureControlledCabinetMode } from '@matter/main/clusters/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
4
|
+
import { oven, powerSource, temperatureControlledCabinetCooler } from '../matterbridgeDeviceTypes.js';
|
|
5
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
6
|
+
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
7
|
+
import { createLevelTemperatureControlClusterServer } from './temperatureControl.js';
|
|
8
|
+
export class Refrigerator extends MatterbridgeEndpoint {
|
|
9
|
+
constructor(name, serial) {
|
|
10
|
+
super([oven, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
11
|
+
this.createDefaultIdentifyClusterServer();
|
|
12
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Refrigerator');
|
|
13
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
14
|
+
this.addFixedLabel('composed', 'Refrigerator');
|
|
15
|
+
}
|
|
16
|
+
addCabinet(name, tagList, currentMode = 1, supportedModes = [
|
|
17
|
+
{ label: 'Auto', mode: 1, modeTags: [{ value: RefrigeratorAndTemperatureControlledCabinetMode.ModeTag.Auto }] },
|
|
18
|
+
{ label: 'RapidCool', mode: 2, modeTags: [{ value: RefrigeratorAndTemperatureControlledCabinetMode.ModeTag.RapidCool }] },
|
|
19
|
+
{ label: 'RapidFreeze', mode: 3, modeTags: [{ value: RefrigeratorAndTemperatureControlledCabinetMode.ModeTag.RapidFreeze }] },
|
|
20
|
+
], selectedTemperatureLevel = 2, supportedTemperatureLevels = ['Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5'], currentTemperature = 1000) {
|
|
21
|
+
const cabinet = this.addChildDeviceType(name, temperatureControlledCabinetCooler, { tagList }, true);
|
|
22
|
+
cabinet.log.logName = name;
|
|
23
|
+
cabinet.createDefaultIdentifyClusterServer();
|
|
24
|
+
createLevelTemperatureControlClusterServer(cabinet, selectedTemperatureLevel, supportedTemperatureLevels);
|
|
25
|
+
this.createDefaultRefrigeratorAndTemperatureControlledCabinetModeClusterServer(cabinet, currentMode, supportedModes);
|
|
26
|
+
cabinet.createDefaultTemperatureMeasurementClusterServer(currentTemperature);
|
|
27
|
+
return cabinet;
|
|
28
|
+
}
|
|
29
|
+
createDefaultRefrigeratorAndTemperatureControlledCabinetModeClusterServer(endpoint, currentMode, supportedModes) {
|
|
30
|
+
endpoint.behaviors.require(MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer, {
|
|
31
|
+
supportedModes,
|
|
32
|
+
currentMode,
|
|
33
|
+
});
|
|
34
|
+
return endpoint;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer extends RefrigeratorAndTemperatureControlledCabinetModeServer {
|
|
38
|
+
initialize() {
|
|
39
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
40
|
+
device.log.info('MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer initialized');
|
|
41
|
+
}
|
|
42
|
+
changeToMode(request) {
|
|
43
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
44
|
+
const supportedMode = this.state.supportedModes.find((supportedMode) => supportedMode.mode === request.newMode);
|
|
45
|
+
if (supportedMode) {
|
|
46
|
+
device.log.info(`MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer: changeToMode (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber}) called with mode ${supportedMode.mode} = ${supportedMode.label}`);
|
|
47
|
+
this.state.currentMode = request.newMode;
|
|
48
|
+
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Success' };
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
device.log.error(`MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer: changeToMode (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber}) called with invalid mode ${request.newMode}`);
|
|
52
|
+
return { status: ModeBase.ModeChangeStatus.InvalidInMode, statusText: 'Invalid mode' };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.2.3-dev-
|
|
3
|
+
"version": "3.2.3-dev-20250820-d283e3d",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.2.3-dev-
|
|
9
|
+
"version": "3.2.3-dev-20250820-d283e3d",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.15.3",
|
|
@@ -153,9 +153,9 @@
|
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
"node_modules/@noble/curves": {
|
|
156
|
-
"version": "1.9.
|
|
157
|
-
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.
|
|
158
|
-
"integrity": "sha512-
|
|
156
|
+
"version": "1.9.7",
|
|
157
|
+
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz",
|
|
158
|
+
"integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==",
|
|
159
159
|
"license": "MIT",
|
|
160
160
|
"dependencies": {
|
|
161
161
|
"@noble/hashes": "1.8.0"
|
|
@@ -215,9 +215,9 @@
|
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
"node_modules/ansi-regex": {
|
|
218
|
-
"version": "6.
|
|
219
|
-
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.
|
|
220
|
-
"integrity": "sha512-
|
|
218
|
+
"version": "6.2.0",
|
|
219
|
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.0.tgz",
|
|
220
|
+
"integrity": "sha512-TKY5pyBkHyADOPYlRT9Lx6F544mPl0vS5Ew7BJ45hA08Q+t3GjbueLliBWN3sMICk6+y7HdyxSzC4bWS8baBdg==",
|
|
221
221
|
"license": "MIT",
|
|
222
222
|
"engines": {
|
|
223
223
|
"node": ">=12"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.2.3-dev-
|
|
3
|
+
"version": "3.2.3-dev-20250820-d283e3d",
|
|
4
4
|
"description": "Matterbridge plugin manager for Matter",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,9 +98,6 @@
|
|
|
98
98
|
"types": "./dist/matter/types.d.ts"
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
|
-
"overrides": {
|
|
102
|
-
"typescript": "5.9.2"
|
|
103
|
-
},
|
|
104
101
|
"dependencies": {
|
|
105
102
|
"@matter/main": "0.15.3",
|
|
106
103
|
"archiver": "7.0.1",
|