The LED manager lets your app control the RGB LED on supported smart glasses. Use it for notification flashes, status indicators, or privacy signals during camera use. Only some devices have LEDs. Check session.capabilities?.hasLight before calling any LED method.

Quick Example

import { MiniAppServer, type MentraSession } from "@mentra/sdk";

const app = new MiniAppServer({
  packageName: "com.example.led-demo",
  apiKey: process.env.API_KEY!,
  port: 3000,
});

app.onSession((session: MentraSession) => {
  // Green LED for 2 seconds
  session.led.setColor("green", 2000);
});

await app.start();

API

session.led.setColor(color)

Turn on the LED with the given color. Uses a default duration of 1000ms.
session.led.setColor("blue");

session.led.setColor(color, durationMs)

Turn on the LED for a specific duration in milliseconds.
session.led.setColor("red", 3000);

session.led.setColor(color, options)

Blink the LED in a pattern. The options object accepts three fields:
FieldTypeDescription
onTimenumberMilliseconds the LED stays on per blink
offTimenumberMilliseconds the LED stays off between blinks
countnumberNumber of times to blink
session.led.setColor("orange", { onTime: 400, offTime: 400, count: 3 });

session.led.off()

Turn off the LED immediately.
session.led.off();

Available Colors

"red", "green", "blue", "orange", "white"

Common Patterns

Notification Flash

A quick double-blink to signal an event without being too distracting.
app.onSession((session: MentraSession) => {
  session.led.setColor("blue", { onTime: 200, offTime: 200, count: 2 });
});

Status Indicator

Hold a solid color while a long-running task is in progress, then turn it off.
app.onSession(async (session: MentraSession) => {
  session.led.setColor("orange", 30000);

  await doSomeWork();

  session.led.off();
});

Error Signal

Three red blinks to indicate something went wrong.
session.led.setColor("red", { onTime: 300, offTime: 300, count: 3 });

Privacy Indicator During Camera Use

Keep the LED on while the camera is streaming so bystanders know recording is active.
app.onSession(async (session: MentraSession) => {
  session.led.setColor("white", 60000);
  await session.camera.startStream();

  // Later, when stopping the stream
  await session.camera.stopStream();
  session.led.off();
});

Capability Check with Fallback

Not every device has an LED. Check before calling, and fall back to another feedback method if needed.
app.onSession((session: MentraSession) => {
  if (session.capabilities?.hasLight) {
    session.led.setColor("green", 1000);
  } else {
    session.logger.info("No LED available on this device");
  }
});

Device Compatibility

DeviceLED SupportColors
Mentra LiveYesAll (red, green, blue, orange, white)
Even Realities G1NoN/A
Vuzix Z100NoN/A
LED commands are fire-and-forget. They resolve immediately after the command is sent to the device.