nathankellenicki / node-poweredup

A Javascript module to interface with LEGO Powered Up components.
https://nathankellenicki.github.io/node-poweredup/
MIT License
483 stars 61 forks source link

TypeError: Cannot read property 'on' of undefined #136

Open TobiasKarl opened 3 years ago

TobiasKarl commented 3 years ago

Hello! I have an issue with connecting to the hub sometimes. Around every other time, I get the following error message below. Do you have any clue what could be the problem?

Thanks!

(Piece of code used to connect to hub) poweredUP.scan(); // Start scanning for Hubs console.log("Scanning for Hubs..."); poweredUP.on("discover", async (hub) => { await hub.connect(); });

/home/apclinux/vcontr/node_modules/node-poweredup/dist/node/nobleabstraction.js:89 this._characteristics[uuid].on("data", (data) => { ^

TypeError: Cannot read property 'on' of undefined at NobleDevice.subscribeToCharacteristic (/home/apclinux/vcontr/node_modules/node-poweredup/dist/node/nobleabstraction.js:89:37) at TechnicMediumHub.connect (/home/apclinux/vcontr/node_modules/node-poweredup/dist/node/hubs/lpf2hub.js:43:25) at async TechnicMediumHub.connect (/home/apclinux/vcontr/node_modules/node-poweredup/dist/node/hubs/technicmediumhub.js:48:9) at async PoweredUP. (/home/apclinux/vcontr/vcontr.js:141:17)