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.
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!
I just went through this. My TP-Link integration has been “broken” (failed setup, will retry) for many months but it wasn’t causing any problems. Until today, I was unable to configure some new devices even though I successfully added them via the Tapo App.
I deleted each TP-Link device one-by-one (after taking a screenshot of each one’s info page so I will know which Automations, Scenes, and Scripts to check), restarted HA (full restart), and the TP-Link Integration was gone. Going in now to add it back in and hoping my device rediscovery and reconfiguration of ALL those Automations, Scenes, and Scripts is not a nightmare.
Ok another update: I had to reconfigure all of my TP Link devices, which was kinda good because it was easy and removing and re-adding the integration cleaned up some old names and duplications. And it was rather easy.
At first most of my Automations, etc. for these devices were unavailable (guessing this is because when HA started the devices were not configured), after reconfiguring all my TP Link devices, I restarted again (full restart), and so far almost all of my Automations, Scenes, and Scripts are intact! This is because most of the names did not change and during restart all of the devices were available and the Automations, etc. were able to be verified.
The only devices and Automations, Scenes, and Scripts I have yet to fix are for the handful of devices that are offline (I have a number of TP Link devices I only use at Christmas time).
Not too bad - I have over 30 TP Link devices and, aside from an hour or two of fiddling around, this was not too much work.