HomeAssistant-Tapo-P100-Control: KeyError result

Hi,

I have a single tapo P100 plug setup via tapo app. When trying to integrate to HA 2022.4.3:

switch:
  platform: tapo_p100_control
  ip_address: 192.168.x.x
  email: !secret tapo_user
  password: !secret tapo_password

I get this error in the log:

Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:83
Integration: Switch (documentation, issues)
First occurred: 14:53:23 (1 occurrences)
Last logged: 14:53:23

Error while setting up tapo_p100_control platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tapo_p100_control/switch.py", line 44, in setup_platform
    add_entities([P100Plug(p100)])
  File "/config/custom_components/tapo_p100_control/switch.py", line 53, in __init__
    self.update()
  File "/config/custom_components/tapo_p100_control/switch.py", line 83, in update
    self._p100.handshake()
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 124, in handshake
    encryptedKey = r.json()["result"]["key"]
KeyError: 'result'

The plug is switched on and connected to the network via static IP and I can ping it from the hassio host. The device has 2.0 hardware version and firmware is 1.0.6 Build 210721 Rel.180949

Thanks

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18

Most upvoted comments

Hi @icicimov

Basically, many of you guys, have 2 different Tapo integrations setup in your custom_components directory. The platform called tapo_p100_control belongs to this repository and there is a bug since HA 2022.4.x release to be fixed. The other platform, called tapo belongs to another repository https://github.com/petretiandrea/home-assistant-tapo-p100, which in its most recent version, is working without any issue and can be setup using the UI.

No conflict between both. This integration stopped working after 2022.4.x update, don’t know exactly why. If you were using tapo_p100_control as platform, you were using actually this integration, and when you configured through UI, you started using the other one.

Hi there, I have the same issue.

I can provide some feedback about this issue.

  • Underlying PyP100 library works perfectly in the homeassistant environment.
  • It’s not a hardware issue.
  • Bug affects HA 2022.4.x
  • Probably this is caused by HA core upgrade.

I’m also a little bit confused about @Budaa comment. I checked for Tapo Controller Integration in UI, but I didn’t find it. I also checked if this integration implements the ConfigFlow and it is not implemented.

Wow @pgpais it solved my issue here as well! Thanks! https://github.com/fishbigger/HomeAssistant-Tapo-P100-Control/issues/49#issuecomment-1095270673

I’ll just elaborate the workaround for other people.

  1. Go to Configuration
  2. Click on a Devices & Services
  3. Click “+ ADD INTEGRATION” in the bottom right corner
  4. Search for “tapo”
  5. Select Tapo Controller
  6. Input your host, email and password (the same that you use in your tapo app)

Voila 🎉

EDIT: It looks like the integration that is showing up in the UI is this one: https://github.com/petretiandrea/home-assistant-tapo-p100

@icicimov as a workaround, try setting it up as an integration on the UI. I was just now able to do it