Matterbridge Test Plugin

2.0.15 · active · verified Tue Apr 21

The `matterbridge-test` package serves as a development and demonstration plugin within the `Matterbridge` ecosystem, a platform designed to bridge various smart home protocols like Matter and Homebridge for unified IoT device control. As of April 2026, its current stable version is 2.0.15. The package exhibits an active release cadence, with frequent patch updates primarily focused on dependency management, internal tooling improvements, and developer experience enhancements. It is not intended for direct end-user functionality but rather provides a reference implementation or testing ground for plugin development within the Matterbridge framework, ensuring compatibility and illustrating integration patterns. A key differentiator is its role in validating the Matterbridge plugin API and its strong adherence to modern TypeScript practices, as evidenced by its included type definitions and strict Node.js engine requirements, facilitating type-safe development for other Matterbridge plugin authors.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to register and initialize the `Matterbridge Test Plugin` within a hypothetical `Matterbridge` instance, including basic configuration, and simulates a graceful shutdown.

import { Matterbridge } from 'matterbridge'; // Assuming 'matterbridge' is the core framework
import { TestPlugin, TestPluginOptions } from 'matterbridge-test';

async function main() {
  // Initialize Matterbridge core (hypothetical instance)
  // In a real scenario, configuration might be loaded from a file or environment.
  const matterbridge = new Matterbridge({
    logLevel: 'debug' // Example Matterbridge core configuration
  });

  // Define configuration for the TestPlugin. This structure is defined by TestPluginOptions.
  const pluginConfig: TestPluginOptions = {
    name: "MyTestPluginInstance",
    testSetting: "exampleValue", // Placeholder for a setting specific to TestPlugin
    // Add other settings as required by TestPluginOptions
  };

  // Register the TestPlugin with the Matterbridge instance.
  // The exact registration API might vary based on the 'matterbridge' framework version.
  console.log(`Registering TestPlugin with config:`, pluginConfig);
  matterbridge.registerPlugin(TestPlugin, pluginConfig);

  // Start the Matterbridge instance, which will initialize and run the registered plugin(s).
  await matterbridge.start();
  console.log("Matterbridge started successfully with Matterbridge Test Plugin.");

  // For a test or demonstration plugin, you might set up a timeout to gracefully shut down
  // or perform specific test actions.
  setTimeout(async () => {
    console.log("Simulating graceful shutdown after 30 seconds...");
    await matterbridge.stop();
    console.log("Matterbridge stopped.");
    process.exit(0);
  }, 30000); // Stop after 30 seconds for demonstration
}

main().catch(err => {
  console.error("An error occurred during Matterbridge operation:", err);
  process.exit(1);
});

view raw JSON →