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

Local key should be a 16-character string #17

Closed
achaiah opened this issue Jun 15, 2020 · 2 comments
Closed

Local key should be a 16-character string #17

achaiah opened this issue Jun 15, 2020 · 2 comments

Comments

@achaiah
Copy link

achaiah commented Jun 15, 2020

I have a 30C vacuum and am seeing this error when trying to set it up in home assistant:

File "/config/custom_components/eufy_vacuum/tuya.py", line 451, 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

My access_token is 22 characters long. I successfully used it on the command line to retrieve information from eufy but it doesn't seem to work with this project. Any pointers would be appreciated.

Thanks

@achaiah
Copy link
Author

achaiah commented Jun 15, 2020

Huh.. so I commented out the assertion about key length but am now getting a different error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/eufy_vacuum/vacuum.py", line 50, in setup_platform
    add_entities([EufyVacuum(device_config)], True)
  File "/config/custom_components/eufy_vacuum/vacuum.py", line 70, in __init__
    device_config['local_key'])
  File "/config/custom_components/eufy_vacuum/tuya.py", line 453, in __init__
    self.cipher = TuyaCipher(local_key, self.version)
  File "/config/custom_components/eufy_vacuum/tuya.py", line 166, in __init__
    self.cipher = Cipher(algorithms.AES(key.encode('ascii')), modes.ECB(),
  File "/usr/local/lib/python3.7/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py", line 35, in __init__
    self.key = _verify_key_size(self, key)
  File "/usr/local/lib/python3.7/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py", line 21, in _verify_key_size
    len(key) * 8, algorithm.name
ValueError: Invalid key size (176) for AES.

@achaiah
Copy link
Author

achaiah commented Jun 16, 2020

Nevermind. Looks like the 30C vacuum is special. I had to look up the info per #1 with an old Android app and adb.

@achaiah achaiah closed this as completed Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant