seikan / homebridge-xiaomi-mi-robot-vacuum

XiaoMi Mi robot vacuum plugin for Homebridge.
Other
64 stars 8 forks source link

Getting token without WiFi? #10

Closed luisiam closed 6 years ago

luisiam commented 6 years ago

I am running homebridge on RPi without a WiFi adapter. Is there any workaround to retrieve the token?

zyt717 commented 6 years ago

https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token_mirobot_new.md this may help.

luisiam commented 6 years ago

I tried to retrieve the token that way. However, I got the error Not able to initialize robot vacuum when restarting homebridge. Does the token retrieving procedure have to be done in the local network?

zyt717 commented 6 years ago

I retrieved the token using a rooted android phone with 4G, not in the local network. It worked for me.

luisiam commented 6 years ago

Is it supposed to be 32 characters only? The token I got is 96 characters

zyt717 commented 6 years ago

I got 32 chars token on a rooted andriod phone,and got 96 chars token on a non-jailbroken iphone.Maybe only 32 chars is supported.

luisiam commented 6 years ago

I tried it the hard way. I am able to get a 32 chars token now. However, I still get the Not able to initialize robot vacuum error. Am I missing something?

zyt717 commented 6 years ago

I'm not using this homebridge plugin so I have no idea with this. I use home assistant to control my vacuum. Then setup homebridge-homeassistant plugin to control vacuum by home app.

seikan commented 6 years ago

@luisiam Try to run your homebridge in debug mode. homebridge -D.

Then you should see the actual error message in your log. Please share the error message so we can resolve it together.

luisiam commented 6 years ago

I hope I didn't publish any password lol


[2017-10-16 00:05:08] [Living Room Vacuum] Discovering Mi Robot Vacuum at "192.168.1.20"
[2017-10-16 00:05:08] [Harmony Hub] Plugin - Configure Accessory: Living Room
[2017-10-16 00:05:08] [Harmony Hub] Finalizing Plugin Launch
[2017-10-16 00:05:09] [CMD Switch] Initializing platform accessory 'Playstation 4'...
[2017-10-16 00:05:09] [Ping] Initializing platform accessory 'Luis'...
[2017-10-16 00:05:09] [Ping] Initializing platform accessory 'Kathy'...
[2017-10-16 00:05:09] [Ping] Initializing platform accessory 'Guest'...
[2017-10-16 00:05:09] [Ping] Initializing platform accessory 'Anyone'...
[2017-10-16 00:05:09] [Harmony Hub] Updated reachability of undefined to false
[2017-10-16 00:05:10] [Foscam] Initializing platform accessory 'Foscam LivingRoom'...
[2017-10-16 00:05:10] [Foscam] FoscamAccessory configured with luisiam 192.168.1.6 89 3
[2017-10-16 00:05:10] [Harmony Hub] received update event from harmonyhubjs-discover. there are 1 hubs
[2017-10-16 00:05:10] [Harmony Hub] Updated reachability of undefined to false
[2017-10-16 00:05:10] [Harmony Hub] Updated reachability of undefined to false
[2017-10-16 00:05:10] [Harmony Hub] Updated reachability of undefined to false
[2017-10-16 00:05:10] [MyQ] Initializing platform accessory 'Garage Door (ID: 43191694)'...
[2017-10-16 00:05:10] [CMD Switch] Playstation 4 is off.
[2017-10-16 00:05:10] [Foscam] Foscam Camera Info: { result: 0,
  productName: 'FI9826W',
  serialNo: 1,
  devName: 'LivingRoom',
  mac: 'C4D655393F2F',
  year: 2017,
  mon: 10,
  day: 14,
  hour: 16,
  min: 15,
  sec: 41,
  timeZone: 28800,
  firmwareVer: '2.11.1.119_p1',
  hardwareVer: '1.4.1.10',
  pkgTime: '2015-3-9_10%3A20%3A44' } rtsp://*****:*****@192.168.1.6:89/videoMain rtsp://luisiam:lIkL0530@@192.168.1.6:89/videoSub
[2017-10-16 00:05:11] Foscam LivingRoom is running on port 42837.
[2017-10-16 00:05:11] [Foscam] FoscamStream: RTSPClient got sdp.
[2017-10-16 00:05:11] [Foscam] FoscamStream: RTSPClient got sdp.
[2017-10-16 00:05:11] [Foscam] LivingRoom is disarmed.
[2017-10-16 00:05:11] [Harmony Hub] created new client for hub with uuid ea06c851-eb16-473d-8977-4a2c43cdb4c1
[2017-10-16 00:05:11] [Harmony Hub] Updated reachability of undefined to true
[2017-10-16 00:05:11] [Harmony Hub] Fetching Logitech Harmony activities...
[2017-10-16 00:05:12] [Nest] [NestFirebase] User null is logged in with custom
HAP Warning: Characteristic 00000054-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000003E-0000-1000-8000-0026BB765291. Adding anyway.
[2017-10-16 00:05:13] [Nest] Software version for Bedroom Thermostat is: 5.6.3-1
[2017-10-16 00:05:13] [Nest] Current temperature for Bedroom Thermostat is: 23 C
[2017-10-16 00:05:13] [Nest] Current humidity for Bedroom Thermostat is: 40%
[2017-10-16 00:05:13] [Nest] Target temperature for Bedroom Thermostat is: 23 C
HAP Warning: Characteristic 00000054-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000003E-0000-1000-8000-0026BB765291. Adding anyway.
[2017-10-16 00:05:13] [Nest] Software version for Dining Room Thermostat is: 5.6.3-1
[2017-10-16 00:05:13] [Nest] Current temperature for Dining Room Thermostat is: 23 C
[2017-10-16 00:05:13] [Nest] Current humidity for Dining Room Thermostat is: 35%
[2017-10-16 00:05:13] [Nest] Target temperature for Dining Room Thermostat is: 22 C
[2017-10-16 00:05:13] [Nest] Initializing platform accessory 'Bedroom Thermostat'...
[2017-10-16 00:05:13] [Nest] Initializing platform accessory 'Dining Room Thermostat'...
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ 753-91-054 │
    └────────────┘

[2017-10-16 00:05:13] Homebridge is running on port 51826.
[2017-10-16 00:05:13] [Harmony Hub] Found activities:
        Listen to Music
        Watch PC
        Sing Karaoke
        Watch Smart TV
        PowerOff
        Play PS4
[2017-10-16 00:05:15] [Living Room Vacuum] { Error: Call to device timed out
    at Timeout.retry [as _onTimeout] (/usr/local/lib/node_modules/miio/lib/device.js:225:18)
    at ontimeout (timers.js:471:11)
    at tryOnTimeout (timers.js:306:5)
    at Timer.listOnTimeout (timers.js:266:5) code: 'timeout' }
(node:7429) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Not able to initialize robot vacuum.
(node:7429) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
seikan commented 6 years ago

@luisiam Can you make sure the robot IP address is correct?

Try to share the output for below command:

miio --discover

luisiam commented 6 years ago

Yes. The IP is correct because I use static IP. Output from miio --discover

Device ID: 51858396
Model info: Unknown
Address: 192.168.1.20
Token: ???
Support: Unknown
seikan commented 6 years ago

Let's use this way. Run the following command with your token.

miio --control 192.168.1.20 --token YOUR_32_DIGITS_TOKEN --method find_me

If it's still not working, try to remove the robot from your Mi home, pair it again, and get the new token.

luisiam commented 6 years ago

Can't connect to device, token could not be found

I am actually retrieving the token from my Windows PC but my homebridge is running on RPi. Does it matter?

seikan commented 6 years ago

It seems like your token is incorrect. Can you try to retrieve the token from your phone again?

luisiam commented 6 years ago

I removed it from Mi Home. Retrieved the new token from my Windows PC.

By the way, is it normal to have everything unknown?

Device ID: 51858396
Model info: Unknown
Address: 192.168.8.1
Token: ********************* via auto-token
Support: Unknown

I try to run the control command afterwards on my Windows PC. I get the following error Could not find device

luisiam commented 6 years ago

Did a factory reset and setup everything again. Works like a champ now. Thanks!