TP-Link Kasa Integration cannot be deleted - Please help

For some reason, my TP Link Kasa integration has failed and there is no link to remove it so that I can re-integrate. Below is the error message. I’m lost as to how to fix this or remove Kasa so that I can re-add it. If I try this, I get:

Aborted

Already configured. Only a single configuration possible.

Logger: homeassistant.config_entries
Source: components/tplink/common.py:139
First occurred: 2:28:34 PM (5 occurrences)
Last logged: 2:28:34 PM

Error setting up entry Suzanne’s heater switch HS100(US) for tplink
Error setting up entry Stairs HS103(US) for tplink
Error setting up entry Front Porch HS200(US) for tplink
Error setting up entry Lava Lamp HS103(US) for tplink
Error setting up entry Side garage door HS200(US) for tplink
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/tplink/init.py”, line 121, in async_setup_entry
static_devices = get_static_devices(config_data)
File “/usr/src/homeassistant/homeassistant/components/tplink/common.py”, line 139, in get_static_devices
for entry in config_data[type_]:
KeyError: ‘light’

To further, here are the entries from the log when starting the container. Seems like a python error? Where can I access these .py files to review/ repair?

2021-11-18 08:47:02 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Suzanne’s heater switch HS100(US) for tplink
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/tplink/init.py”, line 121, in async_setup_entry
static_devices = get_static_devices(config_data)
File “/usr/src/homeassistant/homeassistant/components/tplink/common.py”, line 139, in get_static_devices
for entry in config_data[type_]:
KeyError: ‘light’
2021-11-18 08:47:02 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Stairs HS103(US) for tplink
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/tplink/init.py”, line 121, in async_setup_entry
static_devices = get_static_devices(config_data)
File “/usr/src/homeassistant/homeassistant/components/tplink/common.py”, line 139, in get_static_devices
for entry in config_data[type_]:
KeyError: ‘light’
2021-11-18 08:47:02 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Front Porch HS200(US) for tplink
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/tplink/init.py”, line 121, in async_setup_entry
static_devices = get_static_devices(config_data)
File “/usr/src/homeassistant/homeassistant/components/tplink/common.py”, line 139, in get_static_devices
for entry in config_data[type_]:
KeyError: ‘light’
2021-11-18 08:47:02 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Lava Lamp HS103(US) for tplink
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/tplink/init.py”, line 121, in async_setup_entry
static_devices = get_static_devices(config_data)
File “/usr/src/homeassistant/homeassistant/components/tplink/common.py”, line 139, in get_static_devices
for entry in config_data[type_]:
KeyError: ‘light’
2021-11-18 08:47:02 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Side garage door HS200(US) for tplink
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/tplink/init.py”, line 121, in async_setup_entry
static_devices = get_static_devices(config_data)
File “/usr/src/homeassistant/homeassistant/components/tplink/common.py”, line 139, in get_static_devices
for entry in config_data[type_]:
KeyError: ‘light’

I was just actually able to finally delete the Kasa Devices in HA which then let me re-add TP Link as an integration. I thought the .py files were causing the problem, but as usual, my assumptions were incorrect!

The common.py file was deleted right before the October release. It looks like you are running an older version. The tplink integration was completely rewritten in newer versions.

What is the latest version and the process to update?

Hi Bob, can you please let us know how exactly did you delete the Kasa integration. I am having the same issue where I can’t add item due to already existing.

Hi @kalsang1999 its been a while and my recollection is fuzzy. From what I recall, I deleted all of the Kasa devices in HA then restarted HA and the Integration then was either gone or I could then delete it. I hope this helps you!