mitchellrj / eufy_robovac

Other
105 stars 52 forks source link

homeassistant feedback for tuya_3_3 #6

Closed bionicdude closed 4 years ago

bionicdude commented 4 years ago

Hey,

I tried plumbing this branch in and i get the below error. I'm genuinely confused about local_key. My understanding is that this is synonymous with "access token"? at which point, the error is quite correct..my access token is longer than 16 characters. I can successfully use it to pull down my device id using the instructions here. I feel like maybe i've missed something obvious..

2019-09-07 13:56:42 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up platform eufy_vacu$ Traceback (most recent call last): File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 149, in _as$ await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/eufy_vacuum/vacuum.py", line 50, in setup_platform add_entities([EufyVacuum(device_config)], True) File "/home/homeassistant/.homeassistant/custom_components/eufy_vacuum/vacuum.py", line 70, in __init__ device_config['local_key']) File "/home/homeassistant/.homeassistant/custom_components/eufy_vacuum/tuya.py", line 449, in __init__ raise InvalidKey("Local key should be a 16-character string") custom_components.eufy_vacuum.tuya.InvalidKey: Local key should be a 16-character string

raulfunkie commented 4 years ago

I faced this issue too. Make sure you're following the correct template for defining the values. It used to be: bin/demo DEVICE_ID LOCAL_KEY IP but it now is bin/demo DEVICE_ID IP LOCAL_KEY.

So LOCAL_KEY and IP switched places.

bionicdude commented 4 years ago

thanks, @raulfunkie - However I'm not running the demo, I'm running it from within homeassistant. I didn't lose anything by directly plumbing this test branch into my homeassistant as it wasn't working before anyhow (for me at least).

mitchellrj commented 4 years ago

Hi @bionicdude, what kind of device are you trying to use this with? This library is specifically for the Robovac 30-series. The Robovac 11-series has a different protocol and is not supported yet (see #2).

The local key for the 30-series is not easy to get hold of, unfortunately (see #1). The way I've found to grab it from the Android app is to enable debugging, install the Android debug tools on your computer, connect the computer to the phone and run:

adb logcat -e 'tuya.m.my.group.device.list'

Then pulling localKey from the resulting output.

I'll add something about this to the README.

bionicdude commented 4 years ago

I have a 30C. I'd used the instructions from the component page for homeassistant, but it seems that maybe that's not the correct key i need. I'll follow your instructions and put this local key against the access_token variable in the YAML. At which point, you don't actually need the access_token?

I think it's the naming that's thrown me the most. we're putting the local_key value against the access_token name (and there is a variable called access_token used in the json from the eufylife API). Out of interest, why isn't this variable called local_key in the config YAML instead?

mitchellrj commented 4 years ago

The documentation you've seen refers to the official component (which doesn't support the 30C). This code is an unrelated, unofficial and frankly poorly-written custom component. None of the documentation on the official component applies to this one.

mitchellrj commented 4 years ago

The term access_token is used in the config, because Home Assistant's code is opinionated on the naming of things, and access_token is their preferred term.

bionicdude commented 4 years ago

Thanks for the pointers, @mitchellrj i've debugged my local key out and now just need to make sure the IP is correct as i'm getting a connection error.

I assumed that you could call the variables whatever you liked as it was a custom component. I understand now that you're somewhat constrained in what you can do.

bionicdude commented 4 years ago

for completion, although the connection error appeared in my log during startup, homeassistant has found my vacuum and added it. i tested the locate function and it beeped. thanks for your help.