matterbridge-test 0.0.0

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 ADDED
@@ -0,0 +1,44 @@
1
+ # <img src="https://github.com/Luligu/matterbridge/blob/main/frontend/public/matterbridge%2064x64.png" alt="Matterbridge Logo" width="64px" height="64px">&nbsp;&nbsp;&nbsp;Matterbridge test plugin changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-mqtt and sponsoring it.
6
+
7
+ ## [0.0.1] - 2024-08-28
8
+
9
+ First published release.
10
+
11
+ <a href="https://www.buymeacoffee.com/luligugithub">
12
+ <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
13
+ </a>
14
+
15
+ <!-- Commented out section
16
+ ## [1.1.2] - 2024-03-08
17
+
18
+ ### Added
19
+
20
+ - [Feature 1]: Description of the feature.
21
+ - [Feature 2]: Description of the feature.
22
+
23
+ ### Changed
24
+
25
+ - [Feature 3]: Description of the change.
26
+ - [Feature 4]: Description of the change.
27
+
28
+ ### Deprecated
29
+
30
+ - [Feature 5]: Description of the deprecation.
31
+
32
+ ### Removed
33
+
34
+ - [Feature 6]: Description of the removal.
35
+
36
+ ### Fixed
37
+
38
+ - [Bug 1]: Description of the bug fix.
39
+ - [Bug 2]: Description of the bug fix.
40
+
41
+ ### Security
42
+
43
+ - [Security 1]: Description of the security improvement.
44
+ -->
package/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ @Luligu
package/README.md ADDED
File without changes
@@ -0,0 +1,61 @@
1
+ /* eslint-disable no-console */
2
+ import { execSync } from 'child_process';
3
+ import { readFileSync } from 'fs';
4
+ import path from 'path';
5
+ import readline from 'readline';
6
+
7
+ // Get the latest tag
8
+ let tag = execSync('git describe --tags --abbrev=0').toString().trim();
9
+ if (tag.startsWith('v')) {
10
+ tag = tag.substring(1);
11
+ }
12
+
13
+ // Read the changelog file
14
+ const changelogPath = path.join(process.cwd(), 'CHANGELOG.md');
15
+ const changelog = readFileSync(changelogPath, 'utf8');
16
+
17
+ // Extract the relevant section from the changelog
18
+ const changelogSection = extractChangelogSection(changelog, tag);
19
+
20
+ const title = `Release ${tag}`;
21
+ const notes = `Release notes for version ${tag}\n\n${changelogSection}`;
22
+
23
+ // Log the release details
24
+ console.log(`Creating release with the following details:\nTitle: ${title}\nNotes:\n${notes}`);
25
+
26
+ // Wait for user input before proceeding
27
+ await pressAnyKey();
28
+
29
+ // Create the release
30
+ execSync(`gh release create ${tag} -t "${title}" -n "${notes}"`, { stdio: 'inherit' });
31
+
32
+ /**
33
+ * Extracts the relevant section from the changelog for the given tag.
34
+ * Assumes that each version section in the changelog starts with a heading like "## [tag]".
35
+ * @param {string} changelog - The content of the changelog file.
36
+ * @param {string} tag - The tag for which to extract the changelog section.
37
+ * @returns {string} - The extracted changelog section.
38
+ */
39
+ function extractChangelogSection(changelog, tag) {
40
+ const regex = new RegExp(`## \\[${tag}\\](.*?)(## \\[|$)`, 's');
41
+ const match = changelog.match(regex);
42
+ return match ? match[1].trim() : 'No changelog entry found for this version.';
43
+ }
44
+
45
+ /**
46
+ * Waits for the user to press any key.
47
+ * @returns {Promise<void>}
48
+ */
49
+ function pressAnyKey() {
50
+ return new Promise((resolve) => {
51
+ const rl = readline.createInterface({
52
+ input: process.stdin,
53
+ output: process.stdout,
54
+ });
55
+
56
+ rl.question('Press any key to continue...', () => {
57
+ rl.close();
58
+ resolve();
59
+ });
60
+ });
61
+ }
@@ -0,0 +1,15 @@
1
+ import { Matterbridge, PlatformConfig } from 'matterbridge';
2
+ import { AnsiLogger } from 'matterbridge/logger';
3
+ import { TestPlatform } from './platform.js';
4
+ /**
5
+ * This is the standard interface for Matterbridge plugins.
6
+ * Each plugin should export a default function that follows this signature.
7
+ *
8
+ * @param {Matterbridge} matterbridge - An instance of MatterBridge. This is the main interface for interacting with the MatterBridge system.
9
+ * @param {AnsiLogger} log - An instance of AnsiLogger. This is used for logging messages in a format that can be displayed with ANSI color codes.
10
+ * @param {PlatformConfig} config - The platform configuration.
11
+ * @returns {TestPlatform} - An instance of the SomfyTahomaPlatform. This is the main interface for interacting with the Somfy Tahoma system.
12
+ *
13
+ */
14
+ export default function initializePlugin(matterbridge: Matterbridge, log: AnsiLogger, config: PlatformConfig): TestPlatform;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,YAAY,CAE1H"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { TestPlatform } from './platform.js';
2
+ /**
3
+ * This is the standard interface for Matterbridge plugins.
4
+ * Each plugin should export a default function that follows this signature.
5
+ *
6
+ * @param {Matterbridge} matterbridge - An instance of MatterBridge. This is the main interface for interacting with the MatterBridge system.
7
+ * @param {AnsiLogger} log - An instance of AnsiLogger. This is used for logging messages in a format that can be displayed with ANSI color codes.
8
+ * @param {PlatformConfig} config - The platform configuration.
9
+ * @returns {TestPlatform} - An instance of the SomfyTahomaPlatform. This is the main interface for interacting with the Somfy Tahoma system.
10
+ *
11
+ */
12
+ export default function initializePlugin(matterbridge, log, config) {
13
+ return new TestPlatform(matterbridge, log, config);
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,YAA0B,EAAE,GAAe,EAAE,MAAsB;IAC1G,OAAO,IAAI,YAAY,CAAC,YAAY,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Matterbridge, MatterbridgeDynamicPlatform, PlatformConfig } from 'matterbridge';
2
+ import { AnsiLogger } from 'matterbridge/logger';
3
+ export declare class TestPlatform extends MatterbridgeDynamicPlatform {
4
+ private noDevices;
5
+ private delayStart;
6
+ private throwLoad;
7
+ private throwStart;
8
+ private throwConfigure;
9
+ private throwShutdown;
10
+ constructor(matterbridge: Matterbridge, log: AnsiLogger, config: PlatformConfig);
11
+ onStart(reason?: string): Promise<void>;
12
+ onConfigure(): Promise<void>;
13
+ onShutdown(reason?: string): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAEZ,2BAA2B,EAE3B,cAAc,EAgBf,MAAM,cAAc,CAAC;AAmBtB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,qBAAa,YAAa,SAAQ,2BAA2B;IAE3D,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;gBAElB,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAiBhE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuGvC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI1D"}
@@ -0,0 +1,141 @@
1
+ import { ColorControl, DeviceTypes, LevelControl, MatterbridgeDevice, MatterbridgeDynamicPlatform, OnOff, PowerSource, bridgedNode, electricalSensor, powerSource, rainSensor, smokeCoAlarm, waterFreezeDetector, waterLeakDetector, deviceEnergyManagement, FanControlCluster, FanControl, airQualitySensor, TemperatureMeasurement, RelativeHumidityMeasurement, BooleanState, } from 'matterbridge';
2
+ import { BooleanStateConfiguration, ElectricalPowerMeasurement, ElectricalEnergyMeasurement, CarbonMonoxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurement, OzoneConcentrationMeasurement, FormaldehydeConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm25ConcentrationMeasurement, Pm10ConcentrationMeasurement, RadonConcentrationMeasurement, TvocMeasurement, AirQuality, } from 'matterbridge/cluster';
3
+ import { waiter } from 'matterbridge/utils';
4
+ export class TestPlatform extends MatterbridgeDynamicPlatform {
5
+ // Config
6
+ noDevices = false;
7
+ delayStart = false;
8
+ throwLoad = false;
9
+ throwStart = false;
10
+ throwConfigure = false;
11
+ throwShutdown = false;
12
+ constructor(matterbridge, log, config) {
13
+ super(matterbridge, log, config);
14
+ this.log.info('Initializing platform:', this.config.name);
15
+ if (config.noDevices)
16
+ this.noDevices = config.noDevices;
17
+ if (config.delayStart)
18
+ this.delayStart = config.delayStart;
19
+ if (config.throwLoad)
20
+ this.throwLoad = config.throwLoad;
21
+ if (config.throwStart)
22
+ this.throwStart = config.throwStart;
23
+ if (config.throwConfigure)
24
+ this.throwConfigure = config.throwConfigure;
25
+ if (config.throwShutdown)
26
+ this.throwShutdown = config.throwShutdown;
27
+ if (this.throwLoad)
28
+ throw new Error('Throwing error in load');
29
+ this.log.info('Finished initializing platform:', this.config.name);
30
+ }
31
+ async onStart(reason) {
32
+ this.log.info('onStart called with reason:', reason ?? 'none');
33
+ if (this.throwStart)
34
+ throw new Error('Throwing error in start');
35
+ if (this.delayStart)
36
+ await waiter('Delay start', () => false, false, 20000, 1000);
37
+ if (this.config.longDelayStart)
38
+ await waiter('Delay start', () => false, false, 60000, 1000);
39
+ // Create a new Matterbridge device
40
+ const mbDevice = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
41
+ mbDevice.createDefaultBridgedDeviceBasicInformationClusterServer('Color Temperature Light', 'serial_9874563121', 0xfff1, 'Test plugin', 'colorTemperatureLight', 2, '2.1.1');
42
+ mbDevice.addDeviceType(powerSource);
43
+ mbDevice.createDefaultPowerSourceWiredClusterServer(PowerSource.WiredCurrentType.Ac);
44
+ // mbDevice.createDefaultModeSelectClusterServer();
45
+ const child = mbDevice.addChildDeviceTypeWithClusterServer('PowerSource', [powerSource], [PowerSource.Cluster.id]);
46
+ child.addClusterServer(mbDevice.getDefaultPowerSourceWiredClusterServer());
47
+ mbDevice.addChildDeviceTypeWithClusterServer('Dimmer', [DeviceTypes.COLOR_TEMPERATURE_LIGHT], [OnOff.Cluster.id, LevelControl.Cluster.id, ColorControl.Cluster.id]);
48
+ mbDevice.addFixedLabel('composed', 'Dimmer');
49
+ if (!this.noDevices)
50
+ await this.registerDevice(mbDevice);
51
+ const airQuality = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
52
+ airQuality.createDefaultBridgedDeviceBasicInformationClusterServer('Air Quality sensor', 'serial_98748431222', 0xfff1, 'Test plugin', 'airQualitySensor', 2, '2.1.1');
53
+ airQuality.addDeviceTypeWithClusterServer([airQualitySensor], [
54
+ TemperatureMeasurement.Cluster.id,
55
+ RelativeHumidityMeasurement.Cluster.id,
56
+ CarbonMonoxideConcentrationMeasurement.Cluster.id,
57
+ CarbonDioxideConcentrationMeasurement.Cluster.id,
58
+ NitrogenDioxideConcentrationMeasurement.Cluster.id,
59
+ OzoneConcentrationMeasurement.Cluster.id,
60
+ FormaldehydeConcentrationMeasurement.Cluster.id,
61
+ Pm1ConcentrationMeasurement.Cluster.id,
62
+ Pm25ConcentrationMeasurement.Cluster.id,
63
+ Pm10ConcentrationMeasurement.Cluster.id,
64
+ RadonConcentrationMeasurement.Cluster.id,
65
+ TvocMeasurement.Cluster.id,
66
+ ]);
67
+ airQuality.getClusterServerById(AirQuality.Cluster.id)?.setAirQualityAttribute(AirQuality.AirQualityType.Good);
68
+ airQuality.getClusterServerById(TemperatureMeasurement.Cluster.id)?.setMeasuredValueAttribute(2150);
69
+ airQuality.getClusterServerById(RelativeHumidityMeasurement.Cluster.id)?.setMeasuredValueAttribute(5500);
70
+ if (!this.noDevices)
71
+ await this.registerDevice(airQuality);
72
+ const waterLeak = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
73
+ waterLeak.createDefaultBridgedDeviceBasicInformationClusterServer('Water leak detector', 'serial_98745631222', 0xfff1, 'Test plugin', 'waterLeakDetector', 2, '2.1.1');
74
+ waterLeak.addDeviceTypeWithClusterServer([waterLeakDetector], [BooleanStateConfiguration.Cluster.id]);
75
+ waterLeak.getClusterServerById(BooleanState.Cluster.id)?.setStateValueAttribute(false);
76
+ if (!this.noDevices)
77
+ await this.registerDevice(waterLeak);
78
+ const waterFreeze = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
79
+ waterFreeze.createDefaultBridgedDeviceBasicInformationClusterServer('Water freeze detector', 'serial_98745631223', 0xfff1, 'Test plugin', 'waterFreezeDetector', 2, '2.1.1');
80
+ waterFreeze.addDeviceTypeWithClusterServer([waterFreezeDetector], [BooleanStateConfiguration.Cluster.id]);
81
+ waterFreeze.getClusterServerById(BooleanState.Cluster.id)?.setStateValueAttribute(false);
82
+ if (!this.noDevices)
83
+ await this.registerDevice(waterFreeze);
84
+ const rain = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
85
+ rain.createDefaultBridgedDeviceBasicInformationClusterServer('Rain sensor', 'serial_98745631224', 0xfff1, 'Test plugin', 'rainSensor', 2, '2.1.1');
86
+ rain.addDeviceTypeWithClusterServer([rainSensor], [BooleanStateConfiguration.Cluster.id]);
87
+ rain.getClusterServerById(BooleanState.Cluster.id)?.setStateValueAttribute(false);
88
+ if (!this.noDevices)
89
+ await this.registerDevice(rain);
90
+ const smoke = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
91
+ smoke.createDefaultBridgedDeviceBasicInformationClusterServer('Smoke alarm sensor', 'serial_98745631225', 0xfff1, 'Test plugin', 'smokeCoAlarm', 2, '2.1.1');
92
+ smoke.addDeviceTypeWithClusterServer([smokeCoAlarm], [CarbonMonoxideConcentrationMeasurement.Cluster.id]);
93
+ if (!this.noDevices)
94
+ await this.registerDevice(smoke);
95
+ const electrical = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
96
+ electrical.createDefaultBridgedDeviceBasicInformationClusterServer('Electrical sensor', 'serial_98745631226', 0xfff1, 'Test plugin', 'electricalSensor', 2, '2.1.1');
97
+ electrical.addDeviceTypeWithClusterServer([electricalSensor], [ElectricalPowerMeasurement.Cluster.id, ElectricalEnergyMeasurement.Cluster.id]);
98
+ if (!this.noDevices)
99
+ await this.registerDevice(electrical);
100
+ const energy = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
101
+ energy.createDefaultBridgedDeviceBasicInformationClusterServer('Device Energy Management', 'serial_98745631227', 0xfff1, 'Test plugin', 'deviceEnergyManagement', 2, '2.1.1');
102
+ energy.addDeviceTypeWithClusterServer([deviceEnergyManagement], []);
103
+ if (!this.noDevices)
104
+ await this.registerDevice(energy);
105
+ const fan = new MatterbridgeDevice(bridgedNode, undefined, this.config.debug);
106
+ fan.createDefaultBridgedDeviceBasicInformationClusterServer('Fan', 'serial_98745631228', 0xfff1, 'Test plugin', 'Test fan device', 2, '2.1.1');
107
+ fan.addDeviceTypeWithClusterServer([DeviceTypes.FAN], []);
108
+ if (!this.noDevices)
109
+ await this.registerDevice(fan);
110
+ const fcc = fan.getClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto));
111
+ if (fcc) {
112
+ const fanModeLookup = ['Off', 'Low', 'Medium', 'High', 'On', 'Auto', 'Smart'];
113
+ fcc.subscribeFanModeAttribute((newValue, oldValue) => {
114
+ this.log.info(`Fan mode changed from ${fanModeLookup[oldValue]} to ${fanModeLookup[newValue]}`);
115
+ });
116
+ fcc.subscribePercentSettingAttribute((newValue, oldValue) => {
117
+ this.log.info(`Percent setting changed from ${oldValue} to ${newValue}`);
118
+ });
119
+ fcc.subscribePercentCurrentAttribute((newValue, oldValue) => {
120
+ this.log.info(`Percent current changed from ${oldValue} to ${newValue}`);
121
+ });
122
+ fcc.subscribeSpeedSettingAttribute((newValue, oldValue) => {
123
+ this.log.info(`Speed setting changed from ${oldValue} to ${newValue}`);
124
+ });
125
+ fcc.subscribeSpeedCurrentAttribute((newValue, oldValue) => {
126
+ this.log.info(`Speed current changed from ${oldValue} to ${newValue}`);
127
+ });
128
+ }
129
+ }
130
+ async onConfigure() {
131
+ this.log.info('onConfigure called');
132
+ if (this.throwConfigure)
133
+ throw new Error('Throwing error in configure');
134
+ }
135
+ async onShutdown(reason) {
136
+ this.log.info('onShutdown called with reason:', reason ?? 'none');
137
+ if (this.throwShutdown)
138
+ throw new Error('Throwing error in shutdown');
139
+ }
140
+ }
141
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EAEZ,kBAAkB,EAClB,2BAA2B,EAC3B,KAAK,EAEL,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC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YACH,GAAG,CAAC,8BAA8B,CAAC,CAAC,QAAuB,EAAE,QAAuB,EAAE,EAAE;gBACtF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,8BAA8B,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC;YACzE,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEQ,KAAK,CAAC,WAAW;QACxB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC1E,CAAC;IAEQ,KAAK,CAAC,UAAU,CAAC,MAAe;QACvC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gCAAgC,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC;QAClE,IAAI,IAAI,CAAC,aAAa;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACxE,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ /* eslint-disable no-console */
2
+ import { exec } from 'child_process';
3
+
4
+ const command = process.platform === 'win32' ? 'npm link matterbridge' : 'sudo npm link matterbridge';
5
+
6
+ exec(command, (error, stdout, stderr) => {
7
+ if (error) {
8
+ console.error(`exec error: ${error}`);
9
+ return;
10
+ }
11
+ console.log(`stdout: ${stdout}`);
12
+ if (stderr) {
13
+ console.error(`stderr: ${stderr}`);
14
+ }
15
+ });
@@ -0,0 +1,62 @@
1
+ {
2
+ "title": "Matterbridge test plugin",
3
+ "description": "matterbridge-test v. 1.0.0 by https://github.com/Luligu",
4
+ "type": "object",
5
+ "properties": {
6
+ "name": {
7
+ "description": "Plugin name",
8
+ "type": "string",
9
+ "readOnly": true
10
+ },
11
+ "type": {
12
+ "description": "Plugin type",
13
+ "type": "string",
14
+ "readOnly": true
15
+ },
16
+ "noDevices": {
17
+ "description": "Do not registers any devices (development only)",
18
+ "type": "boolean",
19
+ "default": false
20
+ },
21
+ "delayStart": {
22
+ "description": "Delay start by 20 seconds (development only)",
23
+ "type": "boolean",
24
+ "default": false
25
+ },
26
+ "longDelayStart": {
27
+ "description": "Delay start by 60 seconds (development only)",
28
+ "type": "boolean",
29
+ "default": false
30
+ },
31
+ "throwLoad": {
32
+ "description": "Throw on load (development only)",
33
+ "type": "boolean",
34
+ "default": false
35
+ },
36
+ "throwStart": {
37
+ "description": "Throw on start (development only)",
38
+ "type": "boolean",
39
+ "default": false
40
+ },
41
+ "throwConfigure": {
42
+ "description": "Throw on configure (development only)",
43
+ "type": "boolean",
44
+ "default": false
45
+ },
46
+ "throwShutdown": {
47
+ "description": "Throw on shutdown (development only)",
48
+ "type": "boolean",
49
+ "default": false
50
+ },
51
+ "debug": {
52
+ "description": "Enable the debug for the plugin (development only)",
53
+ "type": "boolean",
54
+ "default": false
55
+ },
56
+ "unregisterOnShutdown": {
57
+ "description": "Unregister all devices on shutdown (development only)",
58
+ "type": "boolean",
59
+ "default": false
60
+ }
61
+ }
62
+ }
package/package.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "matterbridge-test",
3
+ "version": "0.0.0",
4
+ "description": "Matterbridge test plugin",
5
+ "author": "https://github.com/Luligu",
6
+ "license": "Apache-2.0",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Luligu/matterbridge-test.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/Luligu/matterbridge-test/issues"
16
+ },
17
+ "funding": {
18
+ "type": "buymeacoffee",
19
+ "url": "https://www.buymeacoffee.com/luligugithub"
20
+ },
21
+ "keywords": [
22
+ "matterbridge",
23
+ "homebridge",
24
+ "matter",
25
+ "matter.js",
26
+ "matterprotocol",
27
+ "iot",
28
+ "smarthome",
29
+ "connectedthings",
30
+ "tahoma",
31
+ "shelly"
32
+ ],
33
+ "engines": {
34
+ "node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "watch": "tsc --watch",
39
+ "start": "matterbridge",
40
+ "start:bridge": "matterbridge -bridge",
41
+ "start:childbridge": "matterbridge -childbridge",
42
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
43
+ "test:verbose": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose",
44
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
45
+ "test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
46
+ "lint": "eslint --max-warnings=0 .",
47
+ "lint:fix": "eslint --fix --max-warnings=0 .",
48
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
49
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
50
+ "clean": "rimraf tsconfig.tsbuildinfo ./dist",
51
+ "cleanBuild": "npm run clean && tsc",
52
+ "deepClean": "rimraf tsconfig.tsbuildinfo package-lock.json ./dist ./node_modules",
53
+ "deepCleanRebuild": "npm run deepClean && npm install && npm run build",
54
+ "prepublishOnly": "npm run lint && npm run test && npm run cleanBuild",
55
+ "checkDependencies": "npx npm-check-updates",
56
+ "updateDependencies": "npx npm-check-updates -u && npm install & npm run cleanBuild",
57
+ "preversion": "npm run lint && npm run test && npm run build",
58
+ "postversion": "git push && git push --tags && node create-release.js",
59
+ "version:patch": "npm version patch",
60
+ "version:minor": "npm version minor",
61
+ "version:major": "npm version major",
62
+ "matterbridge:add": "matterbridge -add .\\",
63
+ "matterbridge:remove": "matterbridge -remove .\\",
64
+ "matterbridge:enable": "matterbridge -enable .\\",
65
+ "matterbridge:disable": "matterbridge -disable .\\",
66
+ "matterbridge:list": "matterbridge -list",
67
+ "dev:link": "npm link --save-dev matterbridge",
68
+ "dev:install": "npm install --save-dev matterbridge",
69
+ "dev:uninstall": "npm uninstall matterbridge && npm unlink matterbridge",
70
+ "install": "node link-matterbridge-script.js",
71
+ "install:dependencies": "npm install node-ansi-logger node-persist-manager && npm install --save-dev rimraf",
72
+ "install:typescript": "npm install --save-dev typescript @types/node && npm run install && npm run build",
73
+ "install:eslint": "npm install --save-dev eslint @eslint/js @types/eslint__js typescript typescript-eslint@rc-v8",
74
+ "install:prettier": "npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier",
75
+ "install:jest": "npm install --save-dev jest ts-jest @types/jest eslint-plugin-jest"
76
+ },
77
+ "devDependencies": {
78
+ "@eslint/js": "^9.9.1",
79
+ "@types/eslint__js": "^8.42.3",
80
+ "@types/jest": "^29.5.12",
81
+ "@types/node": "^22.5.1",
82
+ "eslint-config-prettier": "^9.1.0",
83
+ "eslint-plugin-jest": "^28.8.0",
84
+ "eslint-plugin-prettier": "^5.2.1",
85
+ "install": "^0.13.0",
86
+ "jest": "^29.7.0",
87
+ "prettier": "^3.3.3",
88
+ "rimraf": "^6.0.1",
89
+ "ts-jest": "^29.2.5",
90
+ "typescript": "^5.5.4",
91
+ "typescript-eslint": "^8.3.0"
92
+ },
93
+ "dependencies": {
94
+ "node-ansi-logger": "^3.0.0",
95
+ "node-persist-manager": "^1.0.8"
96
+ }
97
+ }