Skip to content

Integrating Other Modules

Brian Wente edited this page Sep 5, 2026 · 2 revisions

Integrating other MagicMirror modules

MessageCenter is designed to work with user-facing notifications from ordinary MagicMirror² modules without requiring their authors to add a MessageCenter dependency.

Automatic capture

Valid SHOW_ALERT and SHOW_NOTIFICATION broadcasts are added to passive MessageCenter history automatically. The original module remains responsible for presenting the immediate alert, so MessageCenter does not create a second toast.

this.sendNotification("SHOW_ALERT", {
  title: "Train delayed",
  message: "The 8:15 service is running 12 minutes late."
});

Only this conservative user-facing allowlist is enabled by default. Operational events such as brightness, refresh, registration, visibility, navigation, and presence changes are ignored. MessageCenter also rejects its own emitted events to prevent loops.

Automatic capture can be disabled independently:

internalNotifications: {
  generic: {
    enabled: false
  }
}

Rich messages

A module can opt into stable IDs, attention, retention, expiration, updates, and actions by sending the standard MessageCenter schema directly:

this.sendNotification("MESSAGE_CENTER_MESSAGE", {
  id: "garage-door-open",
  type: "security.entry",
  source: "magicmirror.garage-door",
  title: "Garage door",
  body: "The garage door is still open.",
  urgency: "attention",
  retention: "untilViewed",
  expires: Date.now() + 30 * 60 * 1000
});

MC_MESSAGE remains supported as a compatibility name.

Synchronizing active events

Providers that maintain a complete active set—such as official weather alerts or service disruptions—can use MESSAGE_CENTER_SYNC. Messages missing from a later successful snapshot are resolved automatically:

this.sendNotification("MESSAGE_CENTER_SYNC", {
  source: "official-alert-provider",
  showToasts: false,
  messages: activeAlerts.map((alert) => ({
    id: alert.id,
    type: "weather.alert",
    title: alert.title,
    body: alert.description,
    urgency: alert.urgency,
    retention: alert.retention,
    expires: alert.expires
  }))
});

Snapshots are limited to 100 entries and rejected before anything is removed if an entry is malformed or claims another source. The provider remains responsible for fetching data, selecting relevant events, and mapping severity; MessageCenter remains the router and presentation layer.

Enhanced adapters

Some existing module events contain useful lifecycle information that generic capture cannot infer. A bundled adapter can turn that information into stable updates, automatic resolution, better urgency and retention defaults, or a clearer source label. Current examples include MMM-Remote-Control, the standard weather module, and MMM-PublicTransportHub.

Adapters remain optional. Both MessageCenter and the source module continue to work independently when the other is absent.

Request an adapter

If a module is not captured automatically—or its existing notifications could produce a better MessageCenter experience—please open an adapter request.

Include the module and repository, notification name, a sanitized sample payload, what should appear or be ignored, and whether the event can update or resolve later. Suggested urgency, retention, expiration, and stable-ID behavior are also helpful. Please remove credentials, private addresses, locations, names, and other personal information from examples.

MessageCenter can review and maintain appropriate bundled adapters. Module authors are welcome to collaborate, but they do not need to implement or learn MessageCenter internals.

Clone this wiki locally