rospogrigio / localtuya

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

"add a new device" -> "An unknown error occurred. See log for details." #1604

Open elzinc85 opened 10 months ago

elzinc85 commented 10 months ago

Hello i'm trying to use local tuya integration in HA to not depend of Tuya Cloud anymore. Integration has been done successfully (client id/secret and user ID). getting the device list already registered in IOT Tuya works : image

Try to add a new device (here "prise sapin") : all info are correct image

But i get this error message : "An unknown error occurred. See log for details."

Bellow the log file :

_2023-12-29 15:47:56.152 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception: [Errno 113] Connect call failed ('192.168.xx.xx', 6668) Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 595, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/localtuya/config_flow.py", line 242, in validate_input interface = await pytuya.connect( ^^^^^^^^^^^^^^^^^^^^^ File "/config/customcomponents/localtuya/pytuya/init.py", line 1182, in connect , protocol = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connectcb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.xx.xx', 6668)

I've also tried to register manually a device, : same error Same error too after re-register the local tuya integration

Please not that a telnet on the device IP on 6668 port doesn't respond. Device : antela smart plug.

Thanks for your help :)

gabrys1 commented 10 months ago

I have the same issue. And the same errors in log

2023-12-30 21:28:52.707 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception: [Errno 113] Connect call failed ('192.168.x.x', 6668) Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 595, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/localtuya/config_flow.py", line 242, in validate_input interface = await pytuya.connect( ^^^^^^^^^^^^^^^^^^^^^ File "/config/customcomponents/localtuya/pytuya/init.py", line 1182, in connect , protocol = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.x.x', 6668)

h202-ing commented 10 months ago

Same issue here. The LocalTuya also doesn't detect the correct IP for the device. In this case it detects image

But the IP-Adress is configured by dhcp static lease to this ip: image

A manual configuration of the tuya device fails with this error message:
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/config_flow.py:595
Integration: LocalTuya integration (documentation, issues)
First occurred: 12:58:10 (1 occurrences)
Last logged: 12:58:10

Unexpected exception: [Errno 113] Connect call failed ('192.168.2.50', 6668)
Traceback (most recent call last):
  File "/config/custom_components/localtuya/config_flow.py", line 595, in async_step_configure_device
    self.dps_strings = await validate_input(self.hass, user_input)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/config_flow.py", line 242, in validate_input
    interface = await pytuya.connect(
                ^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 1182, in connect
    _, protocol = await loop.create_connection(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.2.50', 6668)

interesting is, that if I try to ping the tuya devices it says that the destination host is not reachable. No timeout and no response... is that normal to the tuya devices?

BenoitVH commented 10 months ago

Same here, I had already created an issue for that in November (that issue contains my log file)

Issue #1578: "Cannot Connect to device (switch device) - cannot use Cloud API with the Tuya CE (central europe) datacenter"

luckkmaxx commented 10 months ago

Exactly the same error here trying to connect my new lamp. I had never any such problem with my older devices. I thought it could be a device compatibility issue with HA. Not sure were has it to be debugged (Device?, Cloud setup?, Integration?)

paul-plgb commented 10 months ago

I had the same error with a couple of door sensors but have now managed to add the sensors.

I started by trying to add the sensors and then opening the door so it switched the sensor on before I clicked submit. That then took me to the next stage to add the device type ("sensor").

elzinc85600 commented 10 months ago

Same issue here. The LocalTuya also doesn't detect the correct IP for the device. In this case it detects ! ... interesting is, that if I try to ping the tuya devices it says that the destination host is not reachable. No timeout and no response... is that normal to the tuya devices?

in my case there is no error in the IP address used by LocalTuya integration. IP of my wifi device is correct & similar in my local wifi router, cloud IOT tuya, and HomeAssistant with LocalTuya integration. i'm not able to open a telnet of impacted device on port 6668 but i don't know if it's normal or not. From my side, it's the first try with localtuya (i usually use Zwave devices...).

mrcorp34 commented 10 months ago

same issue, while trying to add a couple of sensors. Any resolution available?

morpheus163 commented 10 months ago

I had the same error for a few days, tried to solve it - in the end it helped me to log in to TUYA IOT Platform and accept the new terms of service.

ekvedaras commented 10 months ago

Had same thing, couldn't figure out, just switched to zigbee2mqtt. No crappy hub needed if you have zigbee dongle, works very well and fast. Of course now I have the pleasure of writing configurations for unsuported devices and need to exposure functionality, define data points etc. etc... 😄

BenoitVH commented 10 months ago

Hi, This week I received a message to update to the latest version (v5.2.1). As previous updates did not solve the "add device" issue I was still quite sceptical if I would ever get this to work... But behold, for no apparent reason, my switch device was now recognized. So for now, I'm happy :-)

elzinc85600 commented 10 months ago

So lucky man! it's still the same issue from my side even after a uninstall/reinstall/reconfiguration. Same logs entries.

hui121 commented 9 months ago

My solution: Restart the router, restart Hass, and add again

igrokit commented 9 months ago

Same here...

Any news on this?

igrokit commented 9 months ago

2024-02-10 15:23:53.382 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception: [Errno 113] Connect call failed ('192.168.x.x', 6668) Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 595, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/localtuya/config_flow.py", line 242, in validate_input interface = await pytuya.connect( ^^^^^^^^^^^^^^^^^^^^^ File "/config/customcomponents/localtuya/pytuya/init.py", line 1182, in connect , protocol = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1119, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1101, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1004, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 637, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 677, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.X.X', 6668)

gabrys1 commented 9 months ago

Same here...

Any news on this?

I have installed Snartlife integration. Works fine. Device added. I dont want for Tuya Local solution...

runu1988 commented 7 months ago

i'm having the same issues with some tuya devices (not all) for now this one is giving me trouble:

WIFI TH&Smoke sensor (fzb5up2iehjcrnqy)

Dunnlang commented 4 months ago

I am also having the same issue with my Dekala Arches alarm clock. I have tried going through my Tuya developer console to make sure everything is connected. I re-connected my Local Tuya integration. Unfortunately, it seems to find the alarm clock, but fails to connect.

2024-07-06 18:51:22.527 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception: [Errno 113] Connect call failed ('192.168.XX.XX', 6668) Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 595, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/localtuya/config_flow.py", line 242, in validate_input interface = await pytuya.connect( ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/localtuya/pytuya/__init__.py", line 1182, in connect _, protocol = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1122, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1104, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1007, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.XX.XX', 6668)

avfoto commented 2 months ago

Same error here: Este error se originó a partir de una integración personalizada.

Registrador: custom_components.localtuya.config_flow Fuente: custom_components/localtuya/config_flow.py:595 integración: LocalTuya integration (documentación, problemas) Ocurrió por primera vez: 4 de septiembre de 2024, 21:25:08 (17 ocurrencias) Última vez registrado: 22:06:38

Unexpected exception: [Errno 113] Connect call failed ('192.168.0.140', 6668) Unexpected exception: [Errno 113] Connect call failed ('192.168.0.142', 6668) Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 595, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/localtuya/config_flow.py", line 242, in validate_input interface = await pytuya.connect( ^^^^^^^^^^^^^^^^^^^^^ File "/config/customcomponents/localtuya/pytuya/init.py", line 1182, in connect , protocol = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1122, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1104, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1007, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.0.140', 6668)