bmccluskey / robovac

Add a Eufy RoboVac easily to Home Assistant
Other
120 stars 28 forks source link

unexpected error when sumitting working credentials #14

Open inijman opened 1 year ago

inijman commented 1 year ago

I'm getting an unexpected error when I try to add this integration at the step of supplying the credentials. These definitely are correct: I can login to the web/app, and even running the curl statement gets me a response with a token.

It seems to break in the tuyawebapi session request where I get an 'errorCode': 'USER_PASSWD_WRONG', 'status': 'error', 'errorMsg': 'Incorrect account ID or password'} returned.

Any suggestions why the first script does accept the password, but the second does not?

edit: went through the sniffing process with bluestacks and was able to get to the localkey etc. I've been able to use a basic integration and it works.

However, how to install this repo as working integration bypassing the 'auto configuring' tuya to get the most out f my G30?

mattinx commented 1 year ago

I'm getting the same issue (unexpected error after supplying valid credentials).

I did some more poking at the code it's able to login to the Eufy API server and fetch a list of devices, but fails when attempting to login to Tuya's API to get a list of homes (to fetch the local access tokens). It's able to call TuyaAPISession.determine_password(), and TuyaAPISession.request_token(), and both of which return content. However, the request itself returns: {'t': 1678997709669, 'success': False, 'errorCode': 'USER_PASSWD_WRONG', 'status': 'error', 'errorMsg': 'Incorrect account ID or password'}

I'm wondering if possibly if it's possibly hitting the wrong Tuya endpoint, or possibly something's changed with the credentials being sent to Tuya.

I do have the local key for my devices - I jumped through the process with the old version of the app last year, so being able to scan the devices from the API, then provide the local key manually would be a work-around

I did a quick hack to config_flow.py to remove the Tuya localkey lookup, and added CONF_ACCESS_TOKEN to the config dialog when you set up a vacuum - and that seems to have worked. If I get some free time to hack on things a bit, I'll look into updating the config flow so it fetches the keys from Tuya if it can, and lets you add them at device setup time if it can't. That requires learning how to write Data Entry Flows first, so if someone else wants to do that - don't wait for me :)

hugalafutro commented 1 year ago

I did a quick hack to config_flow.py to remove the Tuya localkey lookup, and added CONF_ACCESS_TOKEN to the config dialog when you set up a vacuum - and that seems to have worked.

@mattinx could you elaborate a bit on this? I have the token, id, key and ip of the vacuum, could you outline more in detail how you used them to bypass the login? Thanks!