rospogrigio / localtuya

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

unable to add any devices to local tuya #1098

Open fire943 opened 2 years ago

fire943 commented 2 years ago

The problem

Unable to add any devices to local tuya

Environment

Steps to reproduce

1.

Configuration configuration.yaml or config_flow

DP dump

This error originated from a custom integration.

Logger: custom_components.localtuya.config_flow Source: custom_components/localtuya/pytuya/init.py:704 Integration: LocalTuya (documentation, issues) First occurred: 11:41:22 AM (2 occurrences) Last logged: 11:55:02 AM

Unexpected exception Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 580, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) File "/config/custom_components/localtuya/config_flow.py", line 245, in validate_input interface = await pytuya.connect( File "/config/customcomponents/localtuya/pytuya/init.py", line 704, in connect , protocol = await loop.create_connection( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection raise exceptions[0] File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect return await fut File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.68.63', 6668)

Provide Home Assistant taceback/logs

Additional information

HSB-collab commented 2 years ago

I have the same issue trying to add devices to localtuya. This used to work.

Environment Localtuya version: 4.1.1 Last working localtuya version (if known and relevant): Home Assistant Core version: Home Assistant 2022.10.5 [] Are you using the Home Assistant Tuya Cloud component ? yes [] Are you using the Tuya App in parallel ? yes

This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:621 Integration: LocalTuya integration (documentation, issues) First occurred: 14:51:15 (4 occurrences) Last logged: 16:34:26

[387...2fa] Failed to get status: 'utf-8' codec can't decode byte 0xaa in position 2: invalid start byte Traceback (most recent call last): File "/config/custom_components/localtuya/pytuya/init.py", line 574, in detect_available_dps data = await self.status() File "/config/custom_components/localtuya/pytuya/init.py", line 507, in status status = await self.exchange(STATUS) File "/config/custom_components/localtuya/pytuya/init.py", line 492, in exchange payload = self._decode_payload(msg.payload) File "/config/custom_components/localtuya/pytuya/init.py", line 621, in _decode_payload payload = payload.decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaa in position 2: invalid start byte

### Update: I found by trial and error with the DPs I could finally add my 3 devices (light bulbs) using localtuya. However, I now have a situation where 2 of the devices I have added with localtuya are working correctly but 1 has been added and says "unavailable". The 3 devices are identical and all are connected via a strong WiFi signal.

Any help would be greatly appreciated.

gg1971 commented 2 years ago

auto-detected when adding

T & H Sensor 1a6cc6f9623dacfd 192.168.3.9 bf1cbfdf43ba06aa25kalf

data from the project https://eu.iot.tuya.com/

Device Information Product Name TH08CBU老界面大量生产的 Device ID bf1cbfdf43ba06aa25kalf Product Category wsdcg Device Status Online Activated At 2022-10-22 13:18:44 Device Association Project rus1 Association gg-116131694342758540785 Data Center Central Europe Data Center Extension Information Sub-Device or Not No IP Address xxx.xxx.xxx.xxx

Logger: custom_components.localtuya.config_flow Source: custom_components/localtuya/pytuya/init.py:704 Integration: LocalTuya integration (documentation, issues) First occurred: 15:50:09 (2 occurrences) Last logged: 15:50:54

Unexpected exception Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 580, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) File "/config/custom_components/localtuya/config_flow.py", line 245, in validate_input interface = await pytuya.connect( File "/config/customcomponents/localtuya/pytuya/init.py", line 704, in connect , protocol = await loop.create_connection( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection raise exceptions[0] File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect return await fut File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.3.9', 6668)

Home Assistant 221026162449

HSB-collab commented 2 years ago

@gg1971 you have included your local device key here. I suggest that you change it by resetting it. Your problem is similar to mine. I made some progress by experimenting with the manual DPs but the issue is not solved for me. I have 3 identical devices 2 of which work (but not consistently) and 1 of which does not work at all even though I can see it is connected to the same WiFi network. I am stuck at that point.