-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Hi,
I am trying to get this library to work with my son's Duplo HUB. It seems to detect and connect to the hub just fine, but I never manage to detect the motor, or any other device.
I've done some debugging and best I can tell the hub simply doesn't have any attached devices.
const PoweredUP = require("node-poweredup");
const poweredUP = new PoweredUP.PoweredUP();
poweredUP.on("discover", async (hub) => {
console.log(`Discovered ${hub.name}!`);
await hub.connect();
console.log('Connected!')
console.log(`Battery level: ${hub.batteryLevel}`);
console.log(`Ports: ${hub.ports}`);
console.log(hub);
if (hub instanceof PoweredUP.DuploTrainBase) {
console.log('Its a duplo train!');
console.log('Waiting for motor');
let devices = await hub.getDevices();
let motor = await hub.waitForDeviceByType(PoweredUP.Consts.DeviceType.DUPLO_TRAIN_BASE_MOTOR);
console.log(motor);
}
poweredUP.scan();
console.log("Scanning...");
The motor promise never resolves unfortunately. I found an old related issue that said to stop the scanning but that does not seem to fix my issue neither.
When I inspect the output of console.log(hub) I see that the attachedDevices array is empty. Similarly, when I print the content of devices, it's an empty list.
How do I get them to attach?
Metadata
Metadata
Assignees
Labels
No labels