Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vacuum - Xiaomi 2nd gen - Roborock S50 - Could not complete call to device - "ok" not 0 #130

Open
nicoh88 opened this issue Mar 21, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@nicoh88
Copy link
Contributor

commented Mar 21, 2018

Hello @aholstenson,

i write currently an new Xiaomi Vacuum Plugin for Homebridge with with miio >= 0.15.6.

activateCharging(); works with 1st generation (stop+return to charge). With the 2nd generation, he stops, but not back to charge.

homebridge[9015]: [2018-3-28 10:41:38] [Staubsauger EG Flur] ACTION | Stop cleaning and go to charge.
homebridge[9015]: (node:9015) UnhandledPromiseRejectionWarning: Error: Could not complete call to device
homebridge[9015]:     at checkResult (/usr/lib/node_modules/homebridge-xiaomi-roborock-vacuum/node_modules/miio/lib/devices/vacuum.js:14:9)
homebridge[9015]:     at <anonymous>
homebridge[9015]: (node:9015) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
homebridge[9015]: (node:9015) [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.
homebridge[9015]: [2018-3-28 10:41:52] [Staubsauger EG Flur] MONITOR | CleaningState has changed, is now false
homebridge[9015]: [2018-3-28 10:41:52] [Staubsauger EG Flur] INFO | Cleaning was stopped.

With miio 0.14.1 it works for both.

Can you fix this?

Thanks,
Nico

UPDATE:
With //.then(checkResult) in vacuum.js (Line 201) it works for 2nd generation.

@nicoh88 nicoh88 changed the title Vaccum - that.device.activateCharging() - no return to charge with 2nd Generation Vaccum - activateCharging() - no return to charge with 2nd Generation Mar 21, 2018

@nicoh88 nicoh88 changed the title Vaccum - activateCharging() - no return to charge with 2nd Generation Vacuum - activateCharging() - no return to charge with 2nd Generation Mar 21, 2018

@aholstenson

This comment has been minimized.

Copy link
Owner

commented Mar 28, 2018

Thanks for opening an issue! What does the V2 vacuum return for the first call to stop?

@nicoh88

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2018

Good question. How do I get the exit code from miio via homebridge?

DEBUG=miio\*,thing\*?

@nicoh88

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2018

That was informative. :)

Xiaomi Mi Robot V1

homebridge[10145]: [2018-3-28 10:48:57] [Staubsauger OG Bad] ACTION | Stop cleaning and go to charge.
homebridge[10145]: 2018-03-28T08:48:57.520Z thing:miio:74167768 -> (5) {"method":"app_stop","params":[],"id":17}
...
homebridge[10145]: 2018-03-28T08:48:57.528Z thing:miio:74167768 <- Message: `{"result":0,"id":17}`
homebridge[10145]: 2018-03-28T08:48:57.529Z thing:miio:74167768 -> (5) {"method":"app_charge","params":[],"id":18}
...
homebridge[10145]: 2018-03-28T08:48:57.536Z thing:miio:74167768 <- Message: `{"result":0,"id":18}`
homebridge[10145]: 2018-03-28T08:48:58.537Z thing:miio:74167768 -> (5) {"method":"get_status","params":[],"id":19}
...
homebridge[10145]: 2018-03-28T08:48:58.540Z thing:miio:74167768 -> (5) {"method":"get_consumable","params":[],"id":20}
...
homebridge[10145]: 2018-03-28T08:48:58.561Z thing:miio:74167768 <- Message: `{"result":[{"msg_ver":6,"msg_seq":943,"state":3,"battery":100,"clean_time":0,"clean_area":0,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":19}`
...
homebridge[10145]: 2018-03-28T08:48:58.564Z thing:miio:74167768 <- Message: `{"result":[{"main_brush_work_time":366756,"side_brush_work_time":366756,"filter_work_time":366756,"sensor_dirty_time":252243}],"id":20}`
homebridge[10145]: 2018-03-28T08:48:58.565Z thing:miio:74167768 Property state changed from cleaning to waiting

Xiaomi Roborock S50

homebridge[10145]: [2018-3-28 10:47:27] [Staubsauger EG Flur] ACTION | Stop cleaning and go to charge.
homebridge[10145]: 2018-03-28T08:47:27.474Z thing:miio:82798803 -> (5) {"method":"app_stop","params":[],"id":11}
...
homebridge[10145]: 2018-03-28T08:47:27.486Z thing:miio:82798803 <- Message: `{"result":["ok"],"id":11}`
homebridge[10145]: (node:10145) UnhandledPromiseRejectionWarning: Error: Could not complete call to device
homebridge[10145]:     at checkResult (/usr/lib/node_modules/homebridge-xiaomi-roborock-vacuum/node_modules/miio/lib/devices/vacuum.js:14:9)
homebridge[10145]:     at <anonymous>
homebridge[10145]:     at process._tickCallback (internal/process/next_tick.js:188:7)
homebridge[10145]: (node:10145) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Result V1 {"result":0,"id":17} vs S50 {"result":["ok"],"id":11}.

@nicoh88

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2018

@aholstenson
I've just updated to Node8.

With all actions from miio comes:

homebridge[18736]: (node:18736) UnhandledPromiseRejectionWarning: Error: Could not complete call to device
homebridge[18736]:     at checkResult (/usr/lib/node_modules/homebridge-xiaomi-roborock-vacuum/node_modules/miio/lib/devices/vacuum.js:16:9)
homebridge[18736]:     at <anonymous>
homebridge[18736]: (node:18736) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function withou

Because the result at Roborock S50 is "ok", not 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.