Skip to content

Can't connect to C210: Server response doesn't match our challenge #1351

@AdrienPoupa

Description

@AdrienPoupa

Hello,

Thanks for adding camera support! I tried to connect to my C210 but unfortunately it does not work with the camera account, here is the full output with the debug flag:

ubuntu-server:/config# kasa --version
kasa, version 0.8.1
ubuntu-server:/config# kasa --host LOCAL_IP --username redacted --password redacted --debug
Discovering device LOCAL_IP for 10 seconds
DEBUG    [DISCOVERY] LOCAL_IP >> {'system': {'get_sysinfo':  discover.py:293
         {}}}
DEBUG    Waiting a total of 10 seconds for responses...          discover.py:535
DEBUG    Created AES transport for LOCAL_IP           sslaestransport.py:129
DEBUG    [DISCOVERY] LOCAL_IP << {'error_code': 0,           discover.py:808
          'result': {'device_id':
         'REDACTED_017C86820E595FE051C4A6C',
                     'device_model': 'C210',
                     'device_name': 'Camera',
                     'device_type': 'SMART.IPCAMERA',
                     'encrypt_info': {'data': 'redacted',
                                      'key': 'redacted',
                                      'sym_schm': 'AES'},
                     'encrypt_type': ['3'],
                     'factory_default': False,
                     'firmware_version': '1.4.3 Build 241010
         Rel.33858n',
                     'hardware_version': '2.0',
                     'ip': 'LOCAL_IP',
                     'is_support_iot_cloud': True,
                     'mac': 'redacted',
                     'mgt_encrypt_schm': {'is_support_https':
         True},
                     'protocol_version': 1}}
DEBUG    Initializing LOCAL_IP of type <class                  device.py:212
         'kasa.smartcam.smartcamdevice.SmartCamDevice'>
DEBUG    LOCAL_IP multi-request-batch-1-of-1 >> '{"meth smartprotocol.py:197
         od":"multipleRequest","request_time_milis":1733597
         981768,"terminal_uuid":"StZfkX/PPdm8qRrUNAnmbA==",
         "params":{"requests":[{"method":"getDeviceInfo","p
         arams":{"device_info":{"name":["basic_info","info"
         ]}}},{"method":"getAppComponentList","params":{"ap
         p_component":{"name":"app_component_list"}}}]}}'
DEBUG    Will to send handshake1...                       sslaestransport.py:431
DEBUG    Posting to https://LOCAL_IP                        httpclient.py:88
DEBUG    Device responded with: {'result': {'data':       sslaestransport.py:450
         {'code': -40401, 'time': 3, 'max_time': 10,
         'encrypt_type': ['3'], 'key': 'redacted', 'nonce': 'redacted',
         'device_confirm': 'redacted'}}, 'error_code': -40413}
DEBUG    Server response doesn't match our challenge on   sslaestransport.py:426
         ip LOCAL_IP
DEBUG    Unable to authenticate with LOCAL_IP, not      smartprotocol.py:116
         retrying: Server response doesn't match our
         challenge on ip LOCAL_IP
Raised error: Server response doesn't match our challenge on ip LOCAL_IP
Traceback (most recent call last):
  File "/usr/local/bin/kasa", line 8, in <module>
    sys.exit(cli())
             ~~~^^
  File "/usr/local/lib/python3.13/site-packages/asyncclick/core.py", line 1205, in __call__
    return anyio.run(self._main, main, args, kwargs, **opts)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/anyio/_core/_eventloop.py", line 74, in run
    return async_backend.run(func, args, {}, backend_options)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 2284, in run
    return runner.run(wrapper())
           ~~~~~~~~~~^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 2272, in wrapper
    return await func(*args)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asyncclick/core.py", line 1208, in _main
    return await main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asyncclick/core.py", line 1120, in main
    rv = await self.invoke(ctx)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/cli/common.py", line 239, in invoke
    _handle_exception(self._debug, exc)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/cli/common.py", line 237, in invoke
    return await super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asyncclick/core.py", line 1717, in invoke
    rv = await super().invoke(ctx)
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asyncclick/core.py", line 1485, in invoke
    return await ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asyncclick/core.py", line 824, in invoke
    rv = await rv
         ^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/cli/main.py", line 363, in cli
    await dev.update()
  File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartdevice.py", line 193, in update
    await self._negotiate()
  File "/usr/local/lib/python3.13/site-packages/kasa/smartcam/smartcamdevice.py", line 185, in _negotiate
    resp = await self.protocol.query(initial_query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/protocols/smartprotocol.py", line 94, in query
    return await self._query(request, retry_count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/protocols/smartprotocol.py", line 119, in _query
    raise ex
  File "/usr/local/lib/python3.13/site-packages/kasa/protocols/smartprotocol.py", line 99, in _query
    return await self._execute_query(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
        request, retry_count=retry, iterate_list_pages=True
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/kasa/protocols/smartcamprotocol.py", line 150, in _execute_query
    return await self._execute_multiple_query(request, retry_count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/protocols/smartprotocol.py", line 203, in _execute_multiple_query
    response_step = await self._transport.send(smart_request)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/transports/sslaestransport.py", line 463, in send
    await self.perform_handshake()
  File "/usr/local/lib/python3.13/site-packages/kasa/transports/sslaestransport.py", line 305, in perform_handshake
    local_nonce, server_nonce, pwd_hash = await self.perform_handshake1()
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/kasa/transports/sslaestransport.py", line 427, in perform_handshake1
    raise AuthenticationError(msg)
kasa.exceptions.AuthenticationError: Server response doesn't match our challenge on ip LOCAL_IP
Exception ignored in: <function ClientSession.__del__ at 0x7dd9baf1a200>
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 443, in __del__
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1891, in call_exception_handler
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1548, in error
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1664, in _log
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1680, in handle
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1736, in callHandlers
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1026, in handle
  File "/usr/local/lib/python3.13/site-packages/rich/logging.py", line 119, in emit
  File "/usr/local/lib/python3.13/logging/__init__.py", line 998, in format
  File "/usr/local/lib/python3.13/logging/__init__.py", line 719, in format
  File "/usr/local/lib/python3.13/logging/__init__.py", line 669, in formatException
  File "/usr/local/lib/python3.13/traceback.py", line 129, in print_exception
  File "/usr/local/lib/python3.13/traceback.py", line 1044, in __init__
  File "/usr/local/lib/python3.13/traceback.py", line 492, in _extract_from_extended_frame_gen
  File "/usr/local/lib/python3.13/traceback.py", line 369, in line
  File "/usr/local/lib/python3.13/traceback.py", line 350, in _set_lines
  File "/usr/local/lib/python3.13/linecache.py", line 25, in getline
  File "/usr/local/lib/python3.13/linecache.py", line 41, in getlines
  File "/usr/local/lib/python3.13/linecache.py", line 88, in updatecache
ImportError: sys.meta_path is None, Python is likely shutting down

I was using a more complex password initially, simplified it in the Tapo app to something like 123456 but the error is still happening. Other Kasa/Tapo devices work flawlessly in HA with python-kasa. Let me know if I can help!

Probably related: home-assistant/core#132526

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions