Skip to content

H200 using Library - Unsupported encryption scheme, works fine via CLI #1410

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

Closed
tess1o opened this issue Jan 2, 2025 · 2 comments
Closed
Labels

Comments

@tess1o
Copy link

tess1o commented Jan 2, 2025

Hello,

I'm using the latest python library version to connect to H200 hub (I have T315 sensor connected to it). Here is the code:

import asyncio
from kasa import Discover

async def main():
    dev = await Discover.discover_single("192.168.50.163", username="my email", password="my pass")
    print(dev)

if __name__ == "__main__":
    asyncio.run(main())

I'm getting this error:

/Users/tessio/DevProjects/python-h200/venv/bin/python /Users/tessio/DevProjects/python-h200/example.py 
Got unsupported connection type: {'device_family': 'SMART.TAPOHUB', 'encryption_type': 'AES', 'https': True}
Traceback (most recent call last):
  File "/Users/tessio/DevProjects/python-h200/example.py", line 9, in <module>
    asyncio.run(main())
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/tessio/DevProjects/python-h200/example.py", line 5, in main
    dev = await Discover.discover_single("192.168.50.163", username="kerriden1@gmail.com", password="preved123")
  File "/Users/tessio/DevProjects/python-h200/venv/lib/python3.9/site-packages/kasa/discover.py", line 537, in discover_single
    raise protocol.unsupported_device_exceptions[ip]
  File "/Users/tessio/DevProjects/python-h200/venv/lib/python3.9/site-packages/kasa/discover.py", line 318, in datagram_received
    device = Discover._get_device_instance(data, config)
  File "/Users/tessio/DevProjects/python-h200/venv/lib/python3.9/site-packages/kasa/discover.py", line 770, in _get_device_instance
    raise UnsupportedDeviceError(
kasa.exceptions.UnsupportedDeviceError: Unsupported encryption scheme 192.168.50.163 of type {'device_family': 'SMART.TAPOHUB', 'encryption_type': 'AES', 'https': True}: {'result': {'device_id': '35AAE47A70FC15388F26F8B116F34ABA', 'device_name': 'Tapo_Hub_2007', 'device_type': 'SMART.TAPOHUB', 'device_model': 'H200', 'ip': '192.168.50.163', 'mac': '20-23-51-C7-20-07', 'hardware_version': '1.0', 'firmware_version': '1.3.6 Build 20240829 rel.71119', 'factory_default': False, 'isResetWiFi': False, 'is_support_iot_cloud': True, 'mgt_encrypt_schm': {'is_support_https': True}, 'encrypt_info': {'sym_schm': 'AES', 'key': 'HiN+If43k80G+4UNBx3OYMxZJBvH3WpUoFI9iN81rvny1/rI2PRGMWB/3nBg7GcQquZyuLQ5KqJmolSmdd+aHrVG+d7hlBbZtLCR4l1+va1ZsXXqMBhmg5OFI3s7b0jjZAaeOpGd8vRo+9Vj9iTm0s0OyNJjPMNL1G9IuPlRO76bgGRcZ8GFjWqi3zQfy0HlgaHXObOiwM0H6Z6p2tl20qcVi7mc0lOOIr+G04Q0/0x8zvQk8jR3e4C6+6d7nOAb3y3MWk+YgaDFeHyof5SzETUWF+ttNRNRjHoB5onGRDEtovPK+ruTjGY33Hq3iQwnLcjOj2ovpVwLASCPl8avkg==', 'data': 'JnQE4HPv/vlyx7qw4/IGT91e5uww6UiEKXhoBZj/4PqlkBcOfrbIQC8YcdTix7zWLHFRsrHDMofjyvq4Kxz1p/R4iSZYT7N/UKRRXeS25s8EyEFe3TuaptV+EkvwrxtC+8sMik9MN0R2ueJlagV/T9w0dWDJt8BEjoPeHMzCPUogsl12S3Nvoy1LIwTmqhBI/G+y9sxwkcdaNqCep3nf/Gc9duX+0hlnfmEsVf9rBiQhPy9n/FKHmLTB6csOKI4V'}, 'encrypt_type': ['3']}, 'error_code': 0}

However, it works fine via CLI, I'm getting no errors and I can get the data from the T315 sensor.

Command: kasa --username my_email --password my_password --host 192.168.50.163 --debug > cli_debug.txt

Debug info from the CLI: cli_debug.txt

Do I miss anything?

@sdb9696
Copy link
Collaborator

sdb9696 commented Jan 3, 2025

I think somehow you're running the wrong version when using the api because python3.9 is no longer supported and if you used uv sync it would have said you need a newer version of python. uv will download the right version of python for you.

Copy link

github-actions bot commented Apr 4, 2025

There hasn't been any activity on this issue recently. This issue has been automatically marked as stale because of that. It will be closed if no further activity occurs.
Please make sure to update to the latest python-kasa version and check if that solves the issue.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 4, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants