You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
root@kasapi:~/python-kasa# uv run kasa --username xxx@gmail.com --password "xxxx" --host 192.168.66.240 --debug
Discovering device 192.168.66.240 for 10 seconds
DEBUG:kasa.discover:[DISCOVERY] 192.168.66.240 >> {'system': {'get_sysinfo': {}}}
DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
DEBUG:kasa.device_factory:Using SmartDevice for SMART.TAPOPLUG
DEBUG:kasa.device_factory:Finding protocol for 192.168.66.240
DEBUG:kasa.device_factory:Finding protocol for DeviceFamily.SmartTapoPlug
DEBUG:kasa.device_factory:Finding transport for SMART.KLAP
DEBUG:kasa.transports.klaptransport:Created KLAP transport for 192.168.66.240
DEBUG:kasa.discover:[DISCOVERY] 192.168.66.240 <<{'error_code': 0, 'result': {'device_id': 'xxxxxx', 'device_model': 'P316M(US)', 'device_type': 'SMART.TAPOPLUG', 'factory_default': False, 'ip': '192.168.66.240', 'is_support_iot_cloud': True, 'mac': 'xxxxx', 'mgt_encrypt_schm': {'encrypt_type': 'KLAP', 'http_port': 80, 'is_support_https': False, 'lv': 2}, 'obd_src': 'tss', 'owner': 'xxx', 'protocol_version': 1}}DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartdevice.SmartDevice'>DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1753058722765,"terminal_uuid":"yyy==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}'DEBUG:kasa.transports.klaptransport:Starting handshake with 192.168.66.240DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/handshake1DEBUG:kasa.transports.klaptransport:Handshake1 posted at 2025-07-20 20:45:22.793551. Host is 192.168.66.240, Response status is 200, Request was xyzDEBUG:kasa.transports.klaptransport:Handshake1 success at 2025-07-20 20:45:22.793643. Host is 192.168.66.240, Server remote_seed is: xyz, server hash is: xyzDEBUG:kasa.transports.klaptransport:Device response did not match our challenge on ip 192.168.66.240, check that your e-mail and password (both case-sensitive) are correct. DEBUG:kasa.protocols.smartprotocol:Unable to authenticate with 192.168.66.240, not retrying: Device response did not match our challenge on ip 192.168.66.240, check that your e-mail and password (both case-sensitive) are correct. == Authentication failed for device == == Discovery Result == Device Type: SMART.TAPOPLUG Device Model: P316M(US) IP: 192.168.66.240 MAC: yyyy Device Id (hash): xx Owner (hash): xx Supports IOT Cloud: True OBD Src: tss Encrypt Type: KLAP HTTP Port: 80 Login version: 2DEBUG:kasa.smart.smartdevice:Querying 192.168.66.240 for modules: Raised error: get_device_info not found in {} for device 192.168.66.240Traceback (most recent call last): File "/root/python-kasa/.venv/bin/kasa", line 10, in <module> sys.exit(cli()) ^^^^^ File "/root/python-kasa/.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 "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1126, in main rv = await self.invoke(ctx) ^^^^^^^^^^^^^^^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 270, in invoke _handle_exception(self._debug, exc) File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 268, in invoke return await super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1728, in invoke rv = await super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1496, in invoke return await ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 829, in invoke rv = await rv ^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/main.py", line 370, in cli await dev.update() File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 277, in update resp = await self._modular_update(first_update, now) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 357, in _modular_update self._update_internal_info(info_resp) File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 259, in _update_internal_info self._info = self._try_get_response(info_resp, "get_device_info") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 196, in _try_get_response raise KasaException(kasa.exceptions.KasaException: get_device_info not found in {} for device 192.168.66.240root@kasapi:~/python-kasa#
The username and password I used is correct, and the above test on a P115 work fine without complaint about "check password" so I speculate this device may use a different kind of API methods?
Actually @rytilahti helped me out in another bug and I have been able to get further with this new device (it was provisioned via tss so I had to disconnect all my tp-link devices, reset to factory then re-associate manually). Now I am getting further with the device BUT I get no power insights.
Followed the instructions and created a PR to add this but its failing some tests, I think because of some unexpected power features this device adds that isn't supported yet?
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.
Activity
TheLinuxGuy commented on Jul 21, 2025
Adding some hopefully helpful debug info
The username and password I used is correct, and the above test on a P115 work fine without complaint about "check password" so I speculate this device may use a different kind of API methods?
TheLinuxGuy commented on Jul 23, 2025
Actually @rytilahti helped me out in another bug and I have been able to get further with this new device (it was provisioned via tss so I had to disconnect all my tp-link devices, reset to factory then re-associate manually). Now I am getting further with the device BUT I get no power insights.
Here is an error when using kasa usage on P316M
TheLinuxGuy commented on Jul 23, 2025
Followed the instructions and created a PR to add this but its failing some tests, I think because of some unexpected power features this device adds that isn't supported yet?
#1561
github-actions commented on Oct 22, 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.
HairNutz commented on Jul 7, 2026
SUCCESS - P316M(US) Working with python-kasa 0.10.2
Environment
Ubuntu 24.04 LXC
python-kasa 0.10.2
Tapo P316M(US)
Firmware: 1.4.1 Build 260420 Rel.012620
Important
The device DID NOT work initially.
Before enabling "Third-Party Device" support in the Tapo app, I received:
== Unsupported device ==
Device Type: SMART.TAPOPLUG
Device Model: P316M(US)
Encrypt Type: TPAP
Login version: 2
Unable to create device
The device was discoverable but could not be queried.
What Fixed It
Open Tapo app
Enable:
Third-Party Device Support
After enabling Third-Party Device Support the device switched to using KLAP authentication instead of appearing as unsupported.
Reset TP-Link account password.
Use the TP-Link account EMAIL address and password with python-kasa.
Before resetting my password I consistently received:
AuthenticationError:
Device response did not match our challenge on ip x.x.x.x
The password stored in my Tapo app appeared valid for app login but would not authenticate from python-kasa.
After resetting the TP-Link account password and using the newly reset password, authentication succeeded.
Working Command
kasa
--host 192.168.1.xxx
--type smart
--username your_email@example.com \ #Case Sensitive
--password 'YourPassword'
state
Useful Command
kasa
--host 192.168.1.xxx
--type smart
--username your_email@example.com
--password 'YourPassword'
feature
This displays per-outlet:
No Home Assistant required.
Example Python Collection Script
p316m_collect.py
import subprocess
import re
from datetime import datetime
result = subprocess.run(
[
"kasa",
"--host", "192.168.1.x",
"--type", "smart",
"--username", "Your_Email@example.com",
"--password", "YourPassword",
"feature"
],
capture_output=True,
text=True
)
current_child = None
for line in result.stdout.splitlines():
m = re.search(r"== Child (.+) ==", line) if m: current_child = m.group(1) continue m = re.search(r"Current consumption .*: ([0-9.]+) W", line) if m and current_child: print( f"{datetime.now().isoformat()} " f"{current_child} " f"{m.group(1)}" )Example output:
2026-07-07T17:10:27 Modem 8.3
2026-07-07T17:10:27 UDMP 18.6
2026-07-07T17:10:27 ProMax 16 35.6
2026-07-07T17:10:27 LabPVE01 52.5