YinHangCode / homebridge-mi-gateway-security

XiaoMi Gateway Security plugin for HomeBridge.
31 stars 5 forks source link

Error at homebridge launch #3

Open niccolospa opened 6 years ago

niccolospa commented 6 years ago

Can you help me to sort this out? I did all the installation ad the read me says, but at launch I get: [2018-1-28 10:09:19] [Security] Initializing MiGatewaySecurity accessory... /usr/lib/node_modules/homebridge-mi-gateway-security/index.js:48 this.device = new miio.Device({ ^

TypeError: miio.Device is not a constructor at new MiGatewaySecurity (/usr/lib/node_modules/homebridge-mi-gateway-security/index.js:48:19) at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:274:29) at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:86:38) at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3)

niccolospa commented 6 years ago

I solved that renaming "Device" to "device" but I encounter this other problem: /usr/lib/node_modules/homebridge-mi-gateway-security/index.js:101 that.device.call("get_arming", []).then(result => { ^

TypeError: that.device.call is not a function at MiGatewaySecurity. (/usr/lib/node_modules/homebridge-mi-gateway-security/index.js:101:29)

YinHangCode commented 6 years ago

You can use 'npm install -g miio@0.14.1' temporarily, then I'll think about a solution.

niccolospa commented 6 years ago

Done, now in console I get: [Security] [MiGatewaySecurity][ERROR]get SecuritySystemTargetState Error: Error: Call to device timed out [2018-1-28 12:33:54] [Security] [MiGatewaySecurity][ERROR]get SecuritySystemCurrentState Error: Error: Call to device timed out

YinHangCode commented 6 years ago

make sure token and ip is right.

niccolospa commented 6 years ago

I double checked both, they should be correct but still getting the 2 errors

niccolospa commented 6 years ago

I was thinking that could conflict with another plugin that is homebridge-miio https://github.com/Bluebie/homebridge-miio could it be?

Kohle81 commented 6 years ago

@niccolospa

I hava the same errors, first time because of miio, then the second error .

Have you solved the problem?

niccolospa commented 6 years ago

Right now I solved because I pasted the wrong token actually

niccolospa commented 6 years ago

I discovered that the token changes every time the gateway is being reset, if can help someone

nikolaevigor commented 6 years ago

Note to further readers. Better to obtain token and ip of the gateway from Mi Home app. To do this in iOS App follow to gateway about page > tap at the bottom of the screen about 5 times > new rows will appear > choose 4th > find token and ip.