Replies: 2 comments
-
|
Hm ... where told you that
is correct? Also
will not work that way. In fact with this your node should not start with any meaningful definition and so thats likely the reason. A very basic example of a WindowCovering you can see in https://github.com/project-chip/matter.js/blob/main/packages/examples/src/device-composed-wc-light/IlluminatedRollerShade.ts ... but likely you do not have "positionAwareLift". I convert this into a discussion because it is more a usage issue then a bug |
Beta Was this translation helpful? Give feedback.
-
|
Hi, First of all, thank you so much for the suggestion and for pointing me to the IlluminatedRollerShade.ts example. It was incredibly helpful and confirmed that manual composition is the right way to approach this. I've tried to replicate the pattern shown in that example to create a standalone WindowCoveringDevice. Unfortunately, I've hit a wall and I'm getting the same error as before: [implementation] EndpointType "behaviors" must be an array of Behavior.Type instances. It seems that the WindowCoveringServer class, even when imported from @matter/main/behaviors as suggested by the example's structure, is not being recognized as a valid Behavior.Type by the Endpoint constructor. I suspect I am still missing something fundamental about how these behaviors are meant to be imported and used in a standalone project outside the matter.js monorepo. Here is the complete code I'm running. It's my attempt to build the simplest possible WindowCoveringDevice based on the official example you shared. The Error Log Any idea why WindowCoveringServer would not be considered a valid Behavior.Type? We have tried everything, including a full npm reinstall, and we always arrive at this final roadblock. Thank you again for your time and any insight you can provide. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I’m trying to expose a very simple roller-shade motor (no position sensor, just OPEN / STOP / CLOSE) to SmartThings through Matter.
Below is the full Node JS bridge I’m running (Matter ↔ MQTT). The device shows up in SmartThings, but:
the “Open”, “Close” and “Stop” buttons are greyed-out (disabled);
the tile always displays “– % open”;
when I tap the tile nothing happens and no MQTT message is published on scs/cover/set/69.
I’m running:
matter.js 0.13.0 (latest at the time of writing)
Node 20.15 on a Debian container
Mosquitto 2.0 on the same host (other MQTT devices work fine)
SmartThings Hub V3, firmware 0.53. Actually pairing succeeds instantly with the QR code.
I suspect I’m missing the right cluster attributes or a feature flag, but can’t figure out which one. Any hint would be appreciated!
`/**
mqtt-roller-shade-basic.js (no feedback)
npm i @matter/main mqtt
package.json has "type": "module"
*/
import { ServerNode, Endpoint, VendorId, DeviceTypeId } from "@matter/main";
import { WindowCoveringDevice } from "@matter/main/devices/window-covering";
import mqtt from "mqtt";
const MQTT_URL = process.env.MQTT_URL ?? "mqtt://localhost";
const COMMAND_TOPIC = process.env.MQTT_COMMAND ?? "scs/cover/set/69";
const STATE_TOPIC = process.env.MQTT_STATE ?? "scs/cover/state/69";
const MATTER_PORT = Number(process.env.MATTER_PORT ?? 5620);
const PASSCODE = Number(process.env.MATTER_PASSCODE ?? 20202021);
const DISCRIMINATOR = Number(process.env.MATTER_DISCRIMINATOR ?? 1200);
async function run() {
const node = await ServerNode.create({
id: "mqtt-roller-shade-basic",
network: { port: MATTER_PORT },
commissioning: { passcode: PASSCODE, discriminator: DISCRIMINATOR },
productDescription: { name: "MQTT Roller Shade (no-feedback)", deviceType: DeviceTypeId(WindowCoveringDevice.deviceType) },
basicInformation: {
vendorName: "matter-bridge", vendorId: VendorId(0xFFF1),
productName: "Roller Shade", productLabel: "Roller Shade",
productId: 0x8002, serialNumber: "rsn-002", uniqueId: "ruid-002",
},
});
// only Lift feature (no AbsolutePosition)
const endpoint = new Endpoint(
WindowCoveringDevice,
{
id: "cover",
behaviorFeatures: { windowCovering: ["Lift"] },
},
);
await node.add(endpoint);
const mq = mqtt.connect(MQTT_URL, { reconnectPeriod: 3000 });
mq.on("connect", () => mq.subscribe(COMMAND_TOPIC, { qos: 1 }));
function publishState(s) {
mq.publish(STATE_TOPIC, s, { qos: 1, retain: false });
}
mq.on("message", async (_topic, buf) => {
const cmd = buf.toString().trim().toUpperCase();
switch (cmd) {
case "OPEN":
case "UP":
await endpoint.command.windowCovering.upOrOpen({});
publishState("open");
break;
case "CLOSE":
case "DOWN":
await endpoint.command.windowCovering.downOrClose({});
publishState("closed");
break;
case "STOP":
case "HALT":
await endpoint.command.windowCovering.stopMotion({});
publishState("stopped");
break;
default:
console.warn("Unknown MQTT command:", cmd);
}
});
await node.run();
console.log(Matter bridge running on port ${MATTER_PORT});
}
run().catch(console.error);
Beta Was this translation helpful? Give feedback.
All reactions