I got a problem when I try to add anothor tuya switch on Local Tuya

I have 2 tuya switches and I have tried to add them to local tuya integration.
First thing, I got my device id and local_key on the IOT Tuya website. The first switch has been added to the local tuya switch perfectly.
The second one is the same type of switch. I did the same way to add it into HASS but I got an error.
I got the device id and local_key of the second switch but I could not add it to the HASS. I got the message “An unknown error occurred. See log for details.” from HASS.
I don’t know why the second switch can’t add to HASS.
Please suggest to me.

This is an error message from the second switch

The first switch can be added to Local Tuya

“see log for details” … so what does the log say? If needed increase logging to ‘debug’

How can I get the log file? Please tell me.
I can access ssh to HASS but I don’t know a path file.

When you go to Settings and then to System …there you can look at Log-entries.
If your log is not configured for lots of details then it would not show much I guess but it should show something related to above error

EDIT: as with all (future) posts in this forum… it might also help to add details on what you are using as a HA setup, core/os and version. I.e. I used docker/container version 2022.6.1

Thank you, I found the log file .
This is an error from log file.

2022-06-09 13:16:40 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception
Traceback (most recent call last):
File “/config/custom_components/localtuya/config_flow.py”, line 283, in async_step_basic_info
self.dps_strings = await validate_input(self.hass, user_input)
File “/config/custom_components/localtuya/config_flow.py”, line 189, in validate_input
interface = await pytuya.connect(
File “/config/custom_components/localtuya/pytuya/init.py”, line 669, in connect
_, protocol = await loop.create_connection(
File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 1065, in create_connection
raise exceptions[0]
File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 1050, in create_connection
sock = await self._connect_sock(
File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 961, in _connect_sock
await self.sock_connect(sock, address)
File “/usr/local/lib/python3.9/asyncio/selector_events.py”, line 499, in sock_connect
return await fut
File “/usr/local/lib/python3.9/asyncio/selector_events.py”, line 534, in _sock_connect_cb
raise OSError(err, f’Connect call failed {address}')
OSError: [Errno 113] Connect call failed (‘192.168.1.136’, 6668)

So, for me the last line seems to indicate that it cannot find the device on that IP.
If you have switched it off and on …DHCP might give it another IP.
On my router I have hard-set IP for Tuya devices based on their MAC

This is my detail of my server.
I install HASS os on Raspberry 4.

Version core-2022.6.4
Installation Type Home Assistant OS
Development false
Supervisor true
Docker true
User root
Virtual Environment false
Python Version 3.9.12
Operating System Family Linux
Operating System Version 5.15.32-v8
CPU Architecture aarch64
Timezone Asia/Bangkok

see reply above… you could posisbly scan your network to find which IP it has now

Some other thoughts
When you re-add a tuya device to your app, it also receives a new local key…doublecheck the tuya dev site if nothing has changed
And…recommend to not put screenshots containing ID and/or key this visible…remove it and brush out (part of the) fields

Ok, I understood. I will check the IP address again. The router may send the package to the wrong IP address. Because local tuya found 3 addresses but I have only 2 devices.

In the red box, my devices are at the first and third options. The second is unknown device. I have only 2 devices.

try to make sure ip, id and key are OK and add manually
Maybe the 2nd one is the new discovered one, i.e. the same device as the first one but now with new ID?

Thank you, I will try when I go back to my home. I will update again.

The problem has been solved.
I have reconnected the device (unpair and repair). It generated the new local key. I got a new local key and put it in my local tuya. It’s work. Thank you all.

great, then please mark this for solution :slight_smile: