Skip to content

Authentication failing on kasa HS103 smart plug. username and PW authenticate in kasa iOS app but fail to authenticate through kasa v 0.10.2 #1711

Description

@jeffdn2

App is woking well with HS105 switches, but apparently new KLAP authentication is not allowing me control with the HS103 versions. HSA103 is Hardware Version 5.0 Firmware Version 1.1.3. The UID and PW have been confirmed to log into the kasa iOS app with both assumed case sensitive. Any help appreciated.
Below is debug of discovery attempt:

(venv) jeffdn@RPiRHRelay:~/Py/RHRelay $ kasa --host 192.168.100.4 --username 'x@xxxxxxb.com' --password 'jxxxxxxxx3' --debug
Discovering device 192.168.100.4 for 10 seconds
DEBUG:kasa.discover:[DISCOVERY] 192.168.100.4 >> {'system': {'get_sysinfo': {}}}
DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
DEBUG:kasa.device_factory:Using IotPlug for IOT.SMARTPLUGSWITCH
DEBUG:kasa.device_factory:Finding protocol for 192.168.100.4
DEBUG:kasa.device_factory:Finding protocol for DeviceFamily.IotSmartPlugSwitch
DEBUG:kasa.device_factory:Finding transport for IOT.KLAP
DEBUG:kasa.transports.klaptransport:Created KLAP transport for 192.168.100.4
DEBUG:kasa.discover:[DISCOVERY] 192.168.100.4 << {'error_code': 0,
'result': {'device_id': 'REDACTED_60f4569065c88852ad20e93',
'device_model': 'HS103(US)',
'device_type': 'IOT.SMARTPLUGSWITCH',
'factory_default': False,
'hw_ver': '5.0',
'ip': '192.168.100.4',
'mac': '54-AF-97-00-00-00',
'mgt_encrypt_schm': {'ANS': False,
'encrypt_type': 'KLAP',
'http_port': 80,
'is_support_https': False,
'lv': 2,
'new_klap': 1},
'obd_src': 'tplink',
'owner': 'REDACTED_AC2FE8FF853CBA6E4C27092',
'protocol_version': 1}}
DEBUG:kasa.device:Initializing 192.168.100.4 of type <class 'kasa.iot.iotplug.IotPlug'>
DEBUG:kasa.iot.iotdevice:Performing the initial update to obtain sysinfo
DEBUG:kasa.protocols.iotprotocol:192.168.100.4 >> {"system":{"get_sysinfo":{}}}
DEBUG:kasa.transports.klaptransport:Starting handshake with 192.168.100.4
DEBUG:kasa.httpclient:Posting to http://192.168.100.4/app/handshake1
DEBUG:kasa.transports.klaptransport:Handshake1 posted at 2026-06-21 14:10:47.514500. Host is 192.168.100.4, Response status is 200, Request was a43bfdbd47e257eb474313d90c2a
DEBUG:kasa.transports.klaptransport:Handshake1 success at 2026-06-21 14:10:47.514896. Host is 192.168.100.4, Server remote_seed is: 47994acebb70c8cd528ecbcc2cfa4acd, serveb
DEBUG:kasa.transports.klaptransport:Device response did not match our challenge on ip 192.168.100.4, check that your e-mail and password (both case-sensitive) are correct.
DEBUG:kasa.protocols.iotprotocol:Unable to authenticate with 192.168.100.4, not retrying
== Authentication failed for device ==
== Discovery Result ==
Device Type: IOT.SMARTPLUGSWITCH
Device Model: HS103(US)
IP: 192.168.100.4
MAC: 54-AF-97-D5-D0-91
Device Id (hash): 1268a6ecc60f4569065c88852ad20e93
Owner (hash): 633B6C030AC2FE8FF853CBA6E4C27092
HW Ver: 5.0
OBD Src: tplink
Encrypt Type: KLAP
HTTP Port: 80
Login version: 2

DEBUG:kasa.iot.iotdevice:Performing the initial update to obtain sysinfo
DEBUG:kasa.protocols.iotprotocol:192.168.100.4 >> {"system":{"get_sysinfo":{}}}
DEBUG:kasa.transports.klaptransport:Starting handshake with 192.168.100.4
DEBUG:kasa.httpclient:Posting to http://192.168.100.4/app/handshake1
DEBUG:kasa.transports.klaptransport:Handshake1 posted at 2026-06-21 14:10:47.707544. Host is 192.168.100.4, Response status is 200, Request was bb759ff7cf1122ff9690227f6879
DEBUG:kasa.transports.klaptransport:Handshake1 success at 2026-06-21 14:10:47.707972. Host is 192.168.100.4, Server remote_seed is: 7f626edf402ceedf8eb3eedf11d4eedf, serve6
DEBUG:kasa.transports.klaptransport:Device response did not match our challenge on ip 192.168.100.4, check that your e-mail and password (both case-sensitive) are correct.
DEBUG:kasa.protocols.iotprotocol:Unable to authenticate with 192.168.100.4, not retrying
Raised error: Device response did not match our challenge on ip 192.168.100.4, check that your e-mail and password (both case-sensitive) are correct.
Traceback (most recent call last):
File "/home/jeffdn/Py/RHRelay/venv/bin/kasa", line 8, in
sys.exit(cli())
^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/cli/common.py", line 282, in call
asyncio.run(self.main(*args, **kwargs))
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/asyncclick/core.py", line 1443, in main
rv = await self.invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/cli/common.py", line 270, in invoke
_handle_exception(self._debug, exc)
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/cli/common.py", line 268, in invoke
return await super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/asyncclick/core.py", line 1934, in invoke
rv = await super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/asyncclick/core.py", line 1306, in invoke
return await ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/asyncclick/core.py", line 873, in invoke
rv = await rv
^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/cli/main.py", line 370, in cli
await dev.update()
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/iot/iotdevice.py", line 315, in update
response = await self.protocol.query(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/protocols/iotprotocol.py", line 83, in query
return await self._query(request, retry_count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/protocols/iotprotocol.py", line 99, in _query
raise auex
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/protocols/iotprotocol.py", line 88, in _query
return await self._execute_query(request, retry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/protocols/iotprotocol.py", line 148, in _execute_query
resp = await self._transport.send(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/transports/klaptransport.py", line 354, in send
await self.perform_handshake()
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/transports/klaptransport.py", line 322, in perform_handshake
local_seed, remote_seed, auth_hash = await self.perform_handshake1()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeffdn/Py/RHRelay/venv/lib/python3.11/site-packages/kasa/transports/klaptransport.py", line 273, in perform_handshake1
raise AuthenticationError(msg)
kasa.exceptions.AuthenticationError: Device response did not match our challenge on ip 192.168.100.4, check that your e-mail and password (both case-sensitive) are correct
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x75258d10>
ERROR:asyncio:Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7526d068>, 141038.754622)])']
connector: <aiohttp.connector.TCPConnector object at 0x75258f90>
(venv) jeffdn@RPiRHRelay:~/Py/RHRelay $

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions