rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.93k stars 563 forks source link

Entity with this ID has already been configured. #460

Closed acs-lux closed 3 years ago

acs-lux commented 3 years ago

The problem

Adding a device that was previously added and removed fails with the error:

Entity with this ID has already been configured.

Environment

Steps to reproduce

  1. Remove device from Local Tuya integration
  2. Ensure entities no longer exist
  3. Try to add the device again

Configuration configuration.yaml or config_flow

Appears in Discovered devices:

431883812cfxxxxxxxxx (Lounge TV Tuya) but can not be added as was previously and the switch integration is not removed as expected.

The Local Tuya entity of switch.lounge_tv_tuya is always unavailable, is not shown in the list of Local Tuya Integration and can not be added again. If the entity is deleted this has no effect, it can not be added.

Provide Home Assistant taceback/logs

Not really relevant but maybe important:

ConnectionResetError: [Errno 104] Connect call failed ('192.168.178.56', 6668) 2021-04-26 11:39:36 ERROR (MainThread) [custom_components.localtuya.common] [050...443] Connect to 192.168.178.61 failed Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 139, in _make_connection self._interface = await pytuya.connect( File "/config/customcomponents/localtuya/pytuya/init.py", line 637, in connect , protocol = await loop.create_connection( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection raise exceptions[0] File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect return await fut File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionResetError: [Errno 104] Connect call failed ('192.168.178.61', 6668) 2021-04-26 11:39:43 ERROR (MainThread) [metno] Access to https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete returned error 'TimeoutError' 2021-04-26 11:39:43 WARNING (MainThread) [homeassistant.components.media_player] Setup of media_player platform androidtv is taking over 10 seconds. 2021-04-26 11:39:43 WARNING (MainThread) [homeassistant.components.media_player] Setup of media_player platform androidtv is taking over 10 seconds. 2021-04-26 11:39:43 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform systemmonitor is taking over 10 seconds. 2021-04-26 11:39:43 WARNING (SyncWorker_4) [custom_components.localtuya.switch] [050...06d] Entity switch.lounge_skts_tuya is requesting unknown DPS index 1 2021-04-26 11:39:44 WARNING (SyncWorker_4) [custom_components.localtuya.switch] [453...43f] Entity switch.kitchencam_skt_tuya is requesting unknown DPS index 1 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of binary_sensor platform gigasetelements is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.cover] Setup of cover platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform localtuya is taking over 10 seconds. 2021-04-26 11:39:44 WARNING (SyncWorker_8) [custom_components.localtuya.switch] [431...aac] Entity switch.kitchen_tv_tuya is requesting unknown DPS index 1

Additional information

Sometimes after restarting all Local Tuya entities are unavailable and reloading does not fix it. Only downgrading and updating the Integration in HACS seems to work.

acs-lux commented 3 years ago

I no longer have this issue. No idea why but its all good now.

atjshop commented 2 years ago

I am having exact same issue. Tried reboot HA still same error.

leocaseiro commented 2 years ago

I had the same issue, and I had to manually remove from the .storage.

If you want to try, make sure you know how to read and write JSON.

FIRST: MAKE SURE YOU SAVE A BACKUP, IN CASE SOMETHING GOES BAD!

I don't know which is the correct file, so I removed the entities I wanted via samba from all the 4 files:

Restart HA!