matterbridge 3.0.7-dev-20250615-2a6da14 → 3.0.7-dev-20250616-cd7fd1c
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 +3 -0
- package/README-DEV.md +27 -21
- package/README.md +3 -3
- package/dist/matterbridge.js +2 -2
- package/dist/matterbridgePlatform.js +3 -8
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -16,11 +16,14 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
16
16
|
|
|
17
17
|
### Added
|
|
18
18
|
|
|
19
|
+
- [template]: Added the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template).
|
|
20
|
+
|
|
19
21
|
### Changed
|
|
20
22
|
|
|
21
23
|
- [package]: Updated dependencies.
|
|
22
24
|
- [package]: Downgrade jest to 29.7.0.
|
|
23
25
|
- [energy]: Added parameter for cumulativeEnergyExported to the helper. For solar power device.
|
|
26
|
+
- [platform]: Removed long deprecated methods: validateEntityBlackList and validateDeviceWhiteBlackList. Use validateDevice and validateEntity.
|
|
24
27
|
|
|
25
28
|
### Fixed
|
|
26
29
|
|
package/README-DEV.md
CHANGED
|
@@ -14,6 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
# Development
|
|
16
16
|
|
|
17
|
+
## How to create your plugin
|
|
18
|
+
|
|
19
|
+
The easiest way is to clone the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template) that has **Dev Container support for instant development environment** and all tools and extensions (like Node.js, npm, TypeScript, ESLint, Prettier, Jest) already loaded and configured.
|
|
20
|
+
|
|
21
|
+
Then change the name (keep matterbridge- at the beginning of the name), version, description, author, homepage, repository, bugs and funding in the package.json.
|
|
22
|
+
|
|
23
|
+
It is possible to add two custom properties to the package.json: **help** and **changelog** with a url that will be used in the frontend instead of the default (/blob/main/README.md and /blob/main/CHANGELOG.md).
|
|
24
|
+
|
|
25
|
+
Add your plugin logic in module.ts.
|
|
26
|
+
|
|
27
|
+
The Matterbridge Plugin Template has an already configured Jest test (coverage 100%) that you can expand while you add your own plugin logic.
|
|
28
|
+
|
|
29
|
+
It also has a workflow configured to run on push and pull request that build, lint and test the plugin on node 18, 20, 22 and 24 with ubuntu, macOS and windows.
|
|
30
|
+
|
|
17
31
|
## Guidelines on imports/exports
|
|
18
32
|
|
|
19
33
|
Matterbridge exports from:
|
|
@@ -66,13 +80,13 @@ Matterbridge exports from:
|
|
|
66
80
|
|
|
67
81
|
- All matter.js types.
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
### WARNING \***\*\*\*\*\***
|
|
70
84
|
|
|
71
85
|
A plugin must never install or import from `@matter` or `@project-chip` directly (neither as a dependency, devDependency, nor peerDependency), as this leads to a second instance of `matter.js`, causing instability and unpredictable errors such as "The only instance is Endpoint".
|
|
72
86
|
|
|
73
87
|
Additionally, when Matterbridge updates the `matter.js` version, it should be consistent across all plugins.
|
|
74
88
|
|
|
75
|
-
|
|
89
|
+
### WARNING \***\*\*\*\*\***
|
|
76
90
|
|
|
77
91
|
A plugin must never install Matterbridge (neither as a dependency, devDependency, nor peerDependency).
|
|
78
92
|
|
|
@@ -86,27 +100,15 @@ Matterbridge must be linked to the plugin in development only. At runtime the pl
|
|
|
86
100
|
}
|
|
87
101
|
```
|
|
88
102
|
|
|
89
|
-
|
|
103
|
+
If you don't use Dev Container from the Matterbridge Plugin Template, on the machine you use for development of your plugin, you need to clone matterbridge, built it locally and link it globally (npm link from the matterbridge package root).
|
|
90
104
|
|
|
91
|
-
If you want to develop a plugin using the dev branch of matterbridge, you have to clone the dev branch of matterbridge, build it locally and link it (npm run deepCleanBuild).
|
|
105
|
+
If you want to develop a plugin using the dev branch of matterbridge (I suggest you do it), you have to clone the dev branch of matterbridge, build it locally and link it (npm run deepCleanBuild does all necessary steps).
|
|
92
106
|
|
|
93
|
-
|
|
107
|
+
Always keep your local instance of matterbridge up to date.
|
|
94
108
|
|
|
95
|
-
|
|
109
|
+
### WARNING \***\*\*\*\*\***
|
|
96
110
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
The easiest way is to clone:
|
|
100
|
-
|
|
101
|
-
- https://github.com/Luligu/matterbridge-example-accessory-platform if you want to create an Accessory Platform Plugin.
|
|
102
|
-
|
|
103
|
-
- https://github.com/Luligu/matterbridge-example-dynamic-platform if you want to create a Dynamic Platform Plugin.
|
|
104
|
-
|
|
105
|
-
Then change the name (keep matterbridge- at the beginning of the name), version, description, author and funding in the package.json.
|
|
106
|
-
|
|
107
|
-
It is possible to add these custom properties to the package.json: help and changelog with a url that will be used in the frontend instead of the default (/blob/main/README.md and /blob/main/CHANGELOG.md).
|
|
108
|
-
|
|
109
|
-
Add your plugin logic in platform.ts.
|
|
111
|
+
Some error messages are logged on start when a plugin has wrong imports or configurations and the plugin will be disabled to prevent instability and crashes.
|
|
110
112
|
|
|
111
113
|
## How to install and register a plugin for development (from github)
|
|
112
114
|
|
|
@@ -197,6 +199,10 @@ It is called when a plugin config includes an action button or an action button
|
|
|
197
199
|
|
|
198
200
|
It is called when the plugin config has been updated.
|
|
199
201
|
|
|
202
|
+
### getDevices(): MatterbridgeEndpoint[]
|
|
203
|
+
|
|
204
|
+
Retrieves the devices registered with the platform.
|
|
205
|
+
|
|
200
206
|
### hasDeviceName(deviceName: string): boolean
|
|
201
207
|
|
|
202
208
|
Checks if a device with this name is already registered in the platform.
|
|
@@ -207,7 +213,7 @@ After you have created your device, add it to the platform.
|
|
|
207
213
|
|
|
208
214
|
### async unregisterDevice(device: MatterbridgeEndpoint)
|
|
209
215
|
|
|
210
|
-
You can unregister
|
|
216
|
+
You can unregister a device.
|
|
211
217
|
|
|
212
218
|
### async unregisterAllDevices()
|
|
213
219
|
|
|
@@ -215,7 +221,7 @@ You can unregister all the devices you added.
|
|
|
215
221
|
|
|
216
222
|
It can be useful to call this method from onShutdown() if you don't want to keep all the devices during development.
|
|
217
223
|
|
|
218
|
-
##
|
|
224
|
+
## MatterbridgeEndpoint api
|
|
219
225
|
|
|
220
226
|
Work in progress...
|
|
221
227
|
|
package/README.md
CHANGED
|
@@ -22,10 +22,10 @@ The developer just focuses on the device development extending the provided clas
|
|
|
22
22
|
|
|
23
23
|
Just pair Matterbridge once, and it will load all your registered plugins.
|
|
24
24
|
|
|
25
|
-
This project aims to allow the porting of homebridge plugins to matterbridge plugins without recoding everything.
|
|
25
|
+
This project aims to allow the porting of homebridge plugins to matterbridge plugins without recoding everything ([Development](README-DEV.md)).
|
|
26
26
|
|
|
27
|
-
It creates a device to pair in any ecosystem like Apple Home, Google Home, Amazon Alexa, or
|
|
28
|
-
any other ecosystem supporting Matter
|
|
27
|
+
It creates a device to pair in any ecosystem like Apple Home, Google Home, Amazon Alexa, Home Assistant or
|
|
28
|
+
any other ecosystem supporting Matter.
|
|
29
29
|
|
|
30
30
|
You don't need a hub or a dedicated new machine.
|
|
31
31
|
|
package/dist/matterbridge.js
CHANGED
|
@@ -1598,10 +1598,10 @@ export class Matterbridge extends EventEmitter {
|
|
|
1598
1598
|
}
|
|
1599
1599
|
startEndAdvertiseTimer(matterServerNode) {
|
|
1600
1600
|
if (this.endAdvertiseTimeout) {
|
|
1601
|
-
this.log.debug(
|
|
1601
|
+
this.log.debug(`Clear ${matterServerNode.id} server node end advertise timer`);
|
|
1602
1602
|
clearTimeout(this.endAdvertiseTimeout);
|
|
1603
1603
|
}
|
|
1604
|
-
this.log.debug(
|
|
1604
|
+
this.log.debug(`Starting ${matterServerNode.id} server node end advertise timer`);
|
|
1605
1605
|
this.endAdvertiseTimeout = setTimeout(() => {
|
|
1606
1606
|
if (matterServerNode.lifecycle.isCommissioned)
|
|
1607
1607
|
return;
|
|
@@ -20,7 +20,6 @@ export class MatterbridgePlatform {
|
|
|
20
20
|
ready;
|
|
21
21
|
_registeredEndpoints = new Map();
|
|
22
22
|
_registeredEndpointsByName = new Map();
|
|
23
|
-
_storedDevices = new Map();
|
|
24
23
|
constructor(matterbridge, log, config) {
|
|
25
24
|
this.matterbridge = matterbridge;
|
|
26
25
|
this.log = log;
|
|
@@ -76,7 +75,6 @@ export class MatterbridgePlatform {
|
|
|
76
75
|
this.selectEntity.clear();
|
|
77
76
|
this._registeredEndpoints.clear();
|
|
78
77
|
this._registeredEndpointsByName.clear();
|
|
79
|
-
this._storedDevices.clear();
|
|
80
78
|
await this.context?.close();
|
|
81
79
|
this.context = undefined;
|
|
82
80
|
await this.storage?.close();
|
|
@@ -90,6 +88,9 @@ export class MatterbridgePlatform {
|
|
|
90
88
|
async onConfigChanged(config) {
|
|
91
89
|
this.log.debug(`The plugin ${CYAN}${config.name}${db} doesn't override onConfigChanged. Received new config.`);
|
|
92
90
|
}
|
|
91
|
+
getDevices() {
|
|
92
|
+
return Array.from(this._registeredEndpoints.values());
|
|
93
|
+
}
|
|
93
94
|
hasDeviceName(deviceName) {
|
|
94
95
|
return this._registeredEndpointsByName.has(deviceName);
|
|
95
96
|
}
|
|
@@ -207,9 +208,6 @@ export class MatterbridgePlatform {
|
|
|
207
208
|
return false;
|
|
208
209
|
return true;
|
|
209
210
|
}
|
|
210
|
-
validateDeviceWhiteBlackList(device, log = true) {
|
|
211
|
-
return this.validateDevice(device, log);
|
|
212
|
-
}
|
|
213
211
|
validateDevice(device, log = true) {
|
|
214
212
|
if (!Array.isArray(device))
|
|
215
213
|
device = [device];
|
|
@@ -239,9 +237,6 @@ export class MatterbridgePlatform {
|
|
|
239
237
|
this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
|
|
240
238
|
return false;
|
|
241
239
|
}
|
|
242
|
-
validateEntityBlackList(device, entity, log = true) {
|
|
243
|
-
return this.validateEntity(device, entity, log);
|
|
244
|
-
}
|
|
245
240
|
validateEntity(device, entity, log = true) {
|
|
246
241
|
if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
|
|
247
242
|
if (log)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.0.7-dev-
|
|
3
|
+
"version": "3.0.7-dev-20250616-cd7fd1c",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.0.7-dev-
|
|
9
|
+
"version": "3.0.7-dev-20250616-cd7fd1c",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.14.0",
|
package/package.json
CHANGED