Skip to content

Tapo P316M energy monitoring power strip support #396

@TheLinuxGuy

Description

@TheLinuxGuy

I purchased a Tapo P316M and it looks like it cannot be discovered or used with this library, my other smart plugs work fine but not this one.

Took the discovery example and using my credentials, it failed to work with http://192.168.66.240:80/app which is the P316M

Firmware version: 1.0.5 Build 250306 Rel.151943
Hardware version: v1.6

Output of discovery with removed successful entries for the P115s that work fine.

:~/plugp100# uv run plugp100/discovery.py 
ERROR:root:Failed to update 192.168.66.240 SMART.TAPOPLUG
Traceback (most recent call last):
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 71, in send_request
    if response := await self._send_request(request, retry):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 84, in _send_request
    self._klap_session = await self.perform_handshake()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 122, in perform_handshake
    if seeds := await self.perform_handshake1():
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 207, in perform_handshake1
    raise Exception(
Exception: Server response doesn't match our challenge on url http://192.168.66.240:80/app

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 71, in send_request
    if response := await self._send_request(request, retry):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 84, in _send_request
    self._klap_session = await self.perform_handshake()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 122, in perform_handshake
    if seeds := await self.perform_handshake1():
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 207, in perform_handshake1
    raise Exception(
Exception: Server response doesn't match our challenge on url http://192.168.66.240:80/app

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 71, in send_request
    if response := await self._send_request(request, retry):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 84, in _send_request
    self._klap_session = await self.perform_handshake()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 122, in perform_handshake
    if seeds := await self.perform_handshake1():
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 207, in perform_handshake1
    raise Exception(
Exception: Server response doesn't match our challenge on url http://192.168.66.240:80/app

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/plugp100/plugp100/discovery.py", line 11, in example_discovery
    await device.update()
  File "/root/plugp100/plugp100/plugp100/new/tapodevice.py", line 60, in update
    components = await self._negotiate_components()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/new/tapodevice.py", line 182, in _negotiate_components
    return (await self.client.get_component_negotiation()).get_or_raise()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/common/functional/tri.py", line 159, in get_or_raise
    raise self.value
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 71, in send_request
    if response := await self._send_request(request, retry):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 84, in _send_request
    self._klap_session = await self.perform_handshake()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 122, in perform_handshake
    if seeds := await self.perform_handshake1():
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/plugp100/plugp100/plugp100/protocol/klap/klap_protocol.py", line 207, in perform_handshake1
    raise Exception(
Exception: Server response doesn't match our challenge on url http://192.168.66.240:80/app

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions