matterbridge-test 2.0.11 → 2.0.12
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 +17 -0
- package/dist/module.js +23 -20
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,23 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
26
26
|
|
|
27
27
|
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
|
|
28
28
|
|
|
29
|
+
## [2.0.12] - 2026-02-27
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- [devContainer]: Add the new [dev container setup](https://matterbridge.io/reflector/MatterbridgeDevContainer.html).
|
|
34
|
+
- [devContainer]: Add the new [reflector dev container setup](https://matterbridge.io/reflector/Reflector.html).
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- [package]: Update dependencies.
|
|
39
|
+
- [package]: Bump package to `automator` v.3.1.0.
|
|
40
|
+
- [package]: Bump `eslint` to v.10.0.2.
|
|
41
|
+
- [package]: Bump `typescript-eslint` to v.8.56.1.
|
|
42
|
+
- [package]: Replace `eslint-plugin-import` with `eslint-plugin-simple-import-sort`.
|
|
43
|
+
|
|
44
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
|
|
45
|
+
|
|
29
46
|
## [2.0.11] - 2026-02-18
|
|
30
47
|
|
|
31
48
|
### Changed
|
package/dist/module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isValidString, waiter } from 'matterbridge/utils';
|
|
1
|
+
import { bridgedNode, colorTemperatureLight, electricalSensor, MatterbridgeDynamicPlatform, MatterbridgeEndpoint, modeSelect, onOffOutlet, onOffSwitch, powerSource, } from 'matterbridge';
|
|
3
2
|
import { CYAN, er, nf } from 'matterbridge/logger';
|
|
4
|
-
import {
|
|
3
|
+
import { BridgedDeviceBasicInformationCluster, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurementCluster, ModeSelectCluster, OnOffCluster, PowerSource, } from 'matterbridge/matter/clusters';
|
|
4
|
+
import { isValidString, waiter } from 'matterbridge/utils';
|
|
5
5
|
export default function initializePlugin(matterbridge, log, config) {
|
|
6
6
|
return new TestPlatform(matterbridge, log, config);
|
|
7
7
|
}
|
|
@@ -60,7 +60,6 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
60
60
|
bridgedNode,
|
|
61
61
|
...(this.config.enableElectrical ? [electricalSensor] : []),
|
|
62
62
|
...(this.config.enablePowerSource ? [powerSource] : []),
|
|
63
|
-
...(this.config.enableModeSelect ? [modeSelect] : []),
|
|
64
63
|
], { id: 'Switch' + i }, this.config.debug);
|
|
65
64
|
switchDevice.log.logName = 'Switch' + i;
|
|
66
65
|
switchDevice.createDefaultBridgedDeviceBasicInformationClusterServer('Switch ' + i, 'serial_switch_' + i, 0xfff1, 'Matterbridge', 'Matterbridge test plugin', parseInt(this.version.replace(/\D/g, '')), this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion);
|
|
@@ -78,8 +77,8 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
78
77
|
if (this.config.enablePowerSource)
|
|
79
78
|
this.addPowerSource(switchDevice, 'wired');
|
|
80
79
|
if (this.config.enableModeSelect) {
|
|
81
|
-
this.addModeSelect(switchDevice, 'Switch ' + i);
|
|
82
|
-
|
|
80
|
+
const composed = await this.addModeSelect(switchDevice, 'Switch ' + i);
|
|
81
|
+
composed.addCommandHandler('changeToMode', async (data) => {
|
|
83
82
|
this.log.info(`Received changeToMode command with request ${data.request.newMode} for endpoint ${data.endpoint?.number}`);
|
|
84
83
|
});
|
|
85
84
|
}
|
|
@@ -97,7 +96,6 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
97
96
|
bridgedNode,
|
|
98
97
|
...(this.config.enableElectrical ? [electricalSensor] : []),
|
|
99
98
|
...(this.config.enablePowerSource ? [powerSource] : []),
|
|
100
|
-
...(this.config.enableModeSelect ? [modeSelect] : []),
|
|
101
99
|
], { id: 'Outlet' + i }, this.config.debug);
|
|
102
100
|
outletDevice.log.logName = 'Outlet' + i;
|
|
103
101
|
outletDevice.createDefaultBridgedDeviceBasicInformationClusterServer('Outlet ' + i, 'serial_outlet_' + i, 0xfff1, 'Matterbridge', 'Matterbridge test plugin', parseInt(this.version.replace(/\D/g, '')), this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion);
|
|
@@ -115,8 +113,8 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
115
113
|
if (this.config.enablePowerSource)
|
|
116
114
|
this.addPowerSource(outletDevice, 'replaceable');
|
|
117
115
|
if (this.config.enableModeSelect) {
|
|
118
|
-
this.addModeSelect(outletDevice, 'Outlet ' + i);
|
|
119
|
-
|
|
116
|
+
const composed = await this.addModeSelect(outletDevice, 'Outlet ' + i);
|
|
117
|
+
composed.addCommandHandler('changeToMode', async (data) => {
|
|
120
118
|
this.log.info(`Received command changeToMode with request ${data.request.newMode} for endpoint ${data.endpoint?.number}`);
|
|
121
119
|
});
|
|
122
120
|
}
|
|
@@ -134,7 +132,6 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
134
132
|
bridgedNode,
|
|
135
133
|
...(this.config.enableElectrical ? [electricalSensor] : []),
|
|
136
134
|
...(this.config.enablePowerSource ? [powerSource] : []),
|
|
137
|
-
...(this.config.enableModeSelect ? [modeSelect] : []),
|
|
138
135
|
], { id: 'Light' + i }, this.config.debug);
|
|
139
136
|
lightDevice.log.logName = 'Light' + i;
|
|
140
137
|
lightDevice.createDefaultBridgedDeviceBasicInformationClusterServer('Light ' + i, 'serial_light_' + i, 0xfff1, 'Matterbridge', 'Matterbridge test plugin', parseInt(this.version.replace(/\D/g, '')), this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion);
|
|
@@ -173,8 +170,8 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
173
170
|
if (this.config.enablePowerSource)
|
|
174
171
|
this.addPowerSource(lightDevice, 'rechargeable');
|
|
175
172
|
if (this.config.enableModeSelect) {
|
|
176
|
-
this.addModeSelect(lightDevice, 'Light ' + i);
|
|
177
|
-
|
|
173
|
+
const composed = await this.addModeSelect(lightDevice, 'Light ' + i);
|
|
174
|
+
composed.addCommandHandler('changeToMode', async (data) => {
|
|
178
175
|
this.log.info(`Received command changeToMode with request ${data.request.newMode} for endpoint ${data.endpoint?.number}`);
|
|
179
176
|
});
|
|
180
177
|
}
|
|
@@ -201,11 +198,14 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
201
198
|
device.createDefaultElectricalPowerMeasurementClusterServer(220 * 1000, 2.5 * 1000, 220 * 2.5 * 1000, 50 * 1000);
|
|
202
199
|
device.createDefaultElectricalEnergyMeasurementClusterServer(1500 * 1000);
|
|
203
200
|
}
|
|
204
|
-
addModeSelect(device, description) {
|
|
205
|
-
device.
|
|
201
|
+
async addModeSelect(device, description) {
|
|
202
|
+
const composed = new MatterbridgeEndpoint(modeSelect, { id: device.id + '_modeSelect' }, this.config.debug);
|
|
203
|
+
composed.createDefaultModeSelectClusterServer(description + ' Led Mode Select', [
|
|
206
204
|
{ label: 'Led ON', mode: 1, semanticTags: [] },
|
|
207
205
|
{ label: 'Led OFF', mode: 2, semanticTags: [] },
|
|
208
206
|
], 1, 1);
|
|
207
|
+
device.parts.add(composed);
|
|
208
|
+
return composed;
|
|
209
209
|
}
|
|
210
210
|
async onConfigure() {
|
|
211
211
|
await super.onConfigure();
|
|
@@ -237,8 +237,9 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
237
237
|
await device?.setAttribute(ElectricalEnergyMeasurementCluster.id, 'cumulativeEnergyImported', { energy: cumulativeEnergy ? cumulativeEnergy.energy + 1000 : 1500 * 1000 }, device.log);
|
|
238
238
|
}
|
|
239
239
|
if (this.config.enableModeSelect) {
|
|
240
|
-
const
|
|
241
|
-
|
|
240
|
+
const composed = device?.parts.get(device.id + '_modeSelect');
|
|
241
|
+
const currentMode = composed?.getAttribute(ModeSelectCluster.id, 'currentMode', device?.log);
|
|
242
|
+
await composed?.setAttribute(ModeSelectCluster.id, 'currentMode', currentMode === 1 ? 2 : 1, device?.log);
|
|
242
243
|
}
|
|
243
244
|
if (this.config.enablePowerSource) {
|
|
244
245
|
if (device?.hasAttributeServer(PowerSource.Cluster.id, 'wiredCurrentType')) {
|
|
@@ -264,8 +265,9 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
264
265
|
await device?.setAttribute(ElectricalEnergyMeasurementCluster.id, 'cumulativeEnergyImported', { energy: cumulativeEnergy ? cumulativeEnergy.energy + 1000 : 1500 * 1000 }, device.log);
|
|
265
266
|
}
|
|
266
267
|
if (this.config.enableModeSelect) {
|
|
267
|
-
const
|
|
268
|
-
|
|
268
|
+
const composed = device?.parts.get(device.id + '_modeSelect');
|
|
269
|
+
const currentMode = composed?.getAttribute(ModeSelectCluster.id, 'currentMode', device?.log);
|
|
270
|
+
await composed?.setAttribute(ModeSelectCluster.id, 'currentMode', currentMode === 1 ? 2 : 1, device?.log);
|
|
269
271
|
}
|
|
270
272
|
if (this.config.enablePowerSource) {
|
|
271
273
|
if (device?.hasAttributeServer(PowerSource.Cluster.id, 'batPercentRemaining')) {
|
|
@@ -291,8 +293,9 @@ export class TestPlatform extends MatterbridgeDynamicPlatform {
|
|
|
291
293
|
await device?.setAttribute(ElectricalEnergyMeasurementCluster.id, 'cumulativeEnergyImported', { energy: cumulativeEnergy ? cumulativeEnergy.energy + 1000 : 1500 * 1000 }, device.log);
|
|
292
294
|
}
|
|
293
295
|
if (this.config.enableModeSelect) {
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
+
const composed = device?.parts.get(device.id + '_modeSelect');
|
|
297
|
+
const currentMode = composed?.getAttribute(ModeSelectCluster.id, 'currentMode', device?.log);
|
|
298
|
+
await composed?.setAttribute(ModeSelectCluster.id, 'currentMode', currentMode === 1 ? 2 : 1, device?.log);
|
|
296
299
|
}
|
|
297
300
|
if (this.config.enablePowerSource) {
|
|
298
301
|
if (device?.hasAttributeServer(PowerSource.Cluster.id, 'batPercentRemaining')) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge-test",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge-test",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.12",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"node-ansi-logger": "3.2.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge-test",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "Matterbridge test plugin",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"node-persist-manager": "2.0.1"
|
|
71
71
|
},
|
|
72
72
|
"overrides": {
|
|
73
|
-
"eslint": "10.0.
|
|
73
|
+
"eslint": "10.0.2",
|
|
74
74
|
"@eslint/js": "10.0.1"
|
|
75
75
|
}
|
|
76
76
|
}
|