mirko3000 / MMM-xiaomi

Xiaomi smarthome plugin for the magic mirror
26 stars 3 forks source link

TypeError: Cannot read property 'length' of undefined #16

Open DDsbv1 opened 4 years ago

DDsbv1 commented 4 years ago

Hello, I have this error when i open MM on a broswer

[22:03:47.907] [ERROR] TypeError: Cannot read property 'length' of undefined at Class.getDevices (/home/pi/MagicMirror/modules/MMM-xiaomi/node_helper.js:70:41) at /home/pi/MagicMirror/modules/MMM-xiaomi/node_helper.js:45:20

I don't understand why it doesn't work...

My miio result :

Device ID: 87476118 Model info: lumi.gateway.v3 Address: 192.168.1.139 Token: 369e4b19b7b01ae1227263bc952aaed5 via stored token Support: At least basic

Device ID: 158d0000ef9071 Model info: lumi.motion Address: Owned by miio:87476118 Token: Automatic via parent device Support: At least basic

Device ID: 158d0000d33ba2 Model info: lumi.switch Address: Owned by miio:87476118 Token: Automatic via parent device Support: At least basic

Device ID: 158d000117d108 Model info: lumi.sensor_ht Address: Owned by miio:87476118 Token: Automatic via parent device Support: At least basic

Device ID: 158d0001141c08 Model info: lumi.sensor_ht Address: Owned by miio:87476118 Token: Automatic via parent device Support: At least basic

My config.js

{ module: 'MMM-xiaomi', position: 'bottom_left', header: 'Temperature/Humidity', // This is optional config: { gatewayIP: '192.168.1.139', gatewayToken: '369e4b19b7b01ae1227263bc952aaed5', rooms: [ { name: 'Salon',sortOrder: 10, devices: ['158d000117d108'] }, }

I hope you could help me. Thank for your work.

mirko3000 commented 4 years ago

Hi, sorry for the late reply. It seems that your gateway does not contain any devices, at least that is where the error comes from. Your config is missing a closing ] for the rooms array - but I don't think this is the root cause. But maybe try that first...

3vidar commented 3 years ago

Hi @mirko3000, I have the same error message: TypeError: Cannot read property 'length' of undefined at Class.getDevices (/Users/sladak/MagicMirror/modules/MMM-xiaomi/node_helper.js:70:41) at /Users/sladak/MagicMirror/modules/MMM-xiaomi/node_helper.js:45:20

My module was working fine until my old gateway became defective. I bought a Xiaomi Mijia Gateway 3 and set it up. I readet out the Tokan of the new Gateway and also of all the sonsors. What I have seen, that the token has a longer string or different format then the old one, could this be the issue? than this is the only thing that I have changet in the config file. New Token of the gateway looks like this: 48473530637c7144596c703932666c37 I would be very grateful if you could help me. I love this module.

3vidar commented 3 years ago

Hi @mirko3000 I think that the error occurs because of the old library. Would there be a way to include the new current library? [(https://www.npmjs.com/package/node-mihome)]

Thanks a lot

SvensonB79 commented 3 years ago

Hi @mirko3000 I think that the error occurs because of the old library. Would there be a way to include the new current library? [(https://www.npmjs.com/package/node-mihome)]

Thanks a lot could you solve this? I have the same problem

mirko3000 commented 3 years ago

Hi @mirko3000 I think that the error occurs because of the old library. Would there be a way to include the new current library? [(https://www.npmjs.com/package/node-mihome)]

Thanks a lot

I will look into it once I find time, thanks for the hints!

3vidar commented 3 years ago

Hi @mirko3000 I think that the error occurs because of the old library. Would there be a way to include the new current library? [(https://www.npmjs.com/package/node-mihome)] Thanks a lot could you solve this? I have the same problem

Unfortunately not, I found an old used gateway and bought this one, now it works great again.

3vidar commented 3 years ago

Hi @mirko3000 I think that the error occurs because of the old library. Would there be a way to include the new current library? [(https://www.npmjs.com/package/node-mihome)] Thanks a lot

I will look into it once I find time, thanks for the hints!

Hi, ooooh that would be great, thanks in advance for your efforts.

gavinfraser6 commented 2 years ago

Hi @mirko3000 Did you by any chance update this?

3vidar commented 1 year ago

Hi @mirko3000 Could be this possible to integrate: https://github.com/Squachen/micloud? There are all Information about all xiaomi devices... thx