From f4300688f84aeb63da6aa4c604f42598ace74be5 Mon Sep 17 00:00:00 2001 From: David <43281665+chaos511@users.noreply.github.com> Date: Tue, 22 Sep 2026 00:18:22 +0000 Subject: [PATCH] 1.5.0: brightness + mode props in the power example (as published to npm) --- examples/ExamplePowerController.js | 10 ++++++++-- package.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/ExamplePowerController.js b/examples/ExamplePowerController.js index ae0a35b..8e6bfb2 100644 --- a/examples/ExamplePowerController.js +++ b/examples/ExamplePowerController.js @@ -23,7 +23,7 @@ alex2NodeClient.connect(); // Connect to the MQTT broker const deviceName = "Bedroom Light"; // Register the device with a unique endpoint ID (you can use something like "endpoint1") -const bedroomLight = alex2NodeClient.registerDevice(deviceName, "endpoint2"); +const bedroomLight = alex2NodeClient.registerDevice(deviceName, "2E3AE9"); // Add the PowerController capability (for turning on/off the device) bedroomLight.addCapability(AlexaInterfaceType.POWER_CONTROLLER); @@ -31,6 +31,9 @@ bedroomLight.addCapability(AlexaInterfaceType.POWER_CONTROLLER); // Log the device name to verify registration console.log(bedroomLight.getName()); +const momentaryModeInstance = "mode.signal.beep"; +const defaultMomentaryMode = "mode.signal.beep.Normal"; + /** * Handle Alexa's ReportState directive. * This occurs when Alexa queries the current state of the device (e.g., during routines or device status checks). @@ -44,7 +47,9 @@ bedroomLight.on("ReportState", (payload) => { status .addHealthProp("OK") // Device is healthy - .addPowerControllerProp(outputState); // Report the current power state (ON/OFF) + .addPowerControllerProp(outputState) // Report the current power state (ON/OFF) + .addBrightnessControllerProp(100) + .addModeControllerProp(momentaryModeInstance, defaultMomentaryMode); status.send(); // Send the state report back to Alexa }); @@ -75,6 +80,7 @@ bedroomLight.on("Event", (directive, interfaceType) => { status .addHealthProp("OK") .addPowerControllerProp(outputState) + .addBrightnessControllerProp(100) .send(); } }); diff --git a/package.json b/package.json index dacc0fe..9b4779e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alex2node", - "version": "1.4.0", + "version": "1.5.0", "description": "A Node.js library for creating Alexa-compatible devices using MQTT, based on Alex2MQTT.", "main": "dist/index.js", "types": "dist/index.d.ts",