aholstenson / miio

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
1.86k stars 353 forks source link

Error: Could not connect to device, handshake timeout #143

Open leoneleone opened 6 years ago

leoneleone commented 6 years ago

Hello,

I've managed to get the correct token for SmartMi Humidifier, using the method described here: (https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token.md)

zhimi.humidifier.ca1 I've added this new model to the models.js file in miio

using this with homebridge-xiaomi-humidifier plugin (which I have updated to use the latest version of miio)

Still can't connect to the Humidifier device. Homebridge log readout:

ERROR:  { Error: Could not connect to device, handshake timeout
    at Timeout.handshakeTimeout.setTimeout [as _onTimeout] (/usr/local/lib/node_modules/miio/lib/network.js:427:17)
    at ontimeout (timers.js:460:11)
    at tryOnTimeout (timers.js:298:5)
    at Timer.listOnTimeout (timers.js:261:5) code: 'timeout', device: null }

@aholstenson Any advice on how to fix this?

your help is much appreciated

pterolex commented 6 years ago

I have the same problem with Xiaomi Gateway v3. Everything worked fine, until recently... It seems that when I installed the latest firmware (1.4.1_154), the discovery stopped working

leoneleone commented 6 years ago

Strangely, I can use miio cli to connect to and control the device in question. Both miio and homebridge are running on the same raspberry pi.

pterolex commented 6 years ago

Thanks, I also forgot to mention that I reset the Gateway and connected it to another network. The gateway worked fine with MiHome on both networks. Now I've reconnected to the previous network, reset the device, attached it and the discovery works.

It seems that since the firmware update, the token is required to connect to gateway. Also, the new MiHome app doesn't expose the tokens anymore in the database, so I had to install an older version...

leoneleone commented 6 years ago

@pterolex How did you get the older version of your gateway’s firmware?

I’m having this problem with a SmartMi Humidifier (zhimi.humidifier.ca1). Happy to try downgrading it’s firmware but don’t know how to do that.

pterolex commented 6 years ago

@leoneleone I didn't.

  1. It seems that after the firmware update, the gateway requires the token to be provided.
  2. I downgraded only the MiHome version (5.0.19) and got the token as usual
gapaus commented 5 years ago

Same problem with humidifier v2. Is anyone fixed it? In AP mode works fine, but after connecting to wifi connection error.

tempico commented 5 years ago

Same to me

slk187 commented 5 years ago

Same problem but different callstack:

Error: Could not connect to device, handshake timeout at Timeout.handshakeTimeout.setTimeout [as _onTimeout] (D:\nodejs\node_modules\miio\lib\network.js:427:17) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) code: 'timeout', device: null

Any solutions?