rospogrigio / localtuya

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

Error adding Tuya Device to local Tuya. #1319

Open dlk57 opened 1 year ago

dlk57 commented 1 year ago

Getting an error. Created the log file below. This is a landscape transformer with 2 sub ports. All other Tuya devices were correctly added to the local Tuya HACS integration. Any ideas.

Logger: custom_components.localtuya.config_flow Source: custom_components/localtuya/pytuya/init.py:1163 Integration: LocalTuya (documentation, issues) First occurred: 2:24:34 PM (2 occurrences) Last logged: 2:25:55 PM

Unexpected exception Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 581, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) File "/config/custom_components/localtuya/config_flow.py", line 240, in validate_input interface = await pytuya.connect( File "/config/customcomponents/localtuya/pytuya/init.py", line 1163, in connect , protocol = await loop.create_connection( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection raise exceptions[0] File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect return await fut File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.4.216', 6668)

dlk57 commented 1 year ago

Below is the code created by Cloud Tuya that is working ok.

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.3.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.10", "docker": true, "arch": "x86_64", "timezone": "America/New_York", "os_name": "Linux", "os_version": "5.15.90", "supervisor": "2023.01.1", "host_os": "Home Assistant OS 9.5", "docker_version": "20.10.22", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.31.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "alexa_media": { "version": "4.6.0", "requirements": [ "alexapy==1.26.4", "packaging>=20.3", "wrapt>=1.12.1" ] }, "wyzeapi": { "version": "0.1.17", "requirements": [ "wyzeapy==0.5.16" ] }, "bhyve": { "version": "3.1.2", "requirements": [] }, "localtuya": { "version": "5.0.0", "requirements": [] }, "govee": { "version": "0.2.2", "requirements": [ "govee-api-laggat==0.2.2", "dacite==1.6.0" ] }, "nest_protect": { "version": "0.3.8", "requirements": [] }, "sonoff": { "version": "3.4.0", "requirements": [ "pycryptodome>=3.6.6" ] } }, "integration_manifest": { "domain": "tuya", "name": "Tuya", "codeowners": [ "@Tuya", "@zlinoliver", "@frenck" ], "config_flow": true, "dependencies": [ "ffmpeg" ], "dhcp": [ { "macaddress": "105A17" }, { "macaddress": "10D561" }, { "macaddress": "1869D8" }, { "macaddress": "381F8D" }, { "macaddress": "508A06" }, { "macaddress": "68572D" }, { "macaddress": "708976" }, { "macaddress": "7CF666" }, { "macaddress": "84E342" }, { "macaddress": "D4A651" }, { "macaddress": "D81F12*" } ], "documentation": "https://www.home-assistant.io/integrations/tuya", "integration_type": "hub", "iot_class": "cloud_push", "loggers": [ "tuya_iot" ], "requirements": [ "tuya-iot-py-sdk==0.6.6" ], "is_built_in": true }, "data": { "endpoint": "https://openapi.tuyaus.com", "auth_type": 0, "country_code": "1", "app_type": "tuyaSmart", "mqtt_connected": true, "disabled_by": null, "disabled_polling": false, "name": "Landscape Lights", "model": "", "category": "kg", "product_id": "ewftzugkakbxzwci", "product_name": "Smart lighting", "online": true, "sub": false, "time_zone": "-05:00", "active_time": "2023-02-06T17:34:12+00:00", "create_time": "2022-10-17T02:07:45+00:00", "update_time": "2023-02-06T17:59:41+00:00", "function": { "switch_1": { "type": "Boolean", "value": {} }, "switch_2": { "type": "Boolean", "value": {} }, "countdown_1": { "type": "Integer", "value": { "unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1 } }, "countdown_2": { "type": "Integer", "value": { "unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1 } }, "cycle_time": { "type": "String", "value": {} } }, "status_range": { "switch_1": { "type": "Boolean", "value": {} }, "switch_2": { "type": "Boolean", "value": {} }, "countdown_1": { "type": "Integer", "value": { "unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1 } }, "countdown_2": { "type": "Integer", "value": { "unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1 } }, "cycle_time": { "type": "String", "value": {} } }, "status": { "switch_1": false, "switch_2": false, "countdown_1": 0, "countdown_2": 0, "cycle_time": "" }, "home_assistant": { "name": "Landscape Lights", "name_by_user": null, "disabled": false, "disabled_by": null, "entities": [ { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": "outlet", "icon": "mdi:lightbulb", "original_icon": null, "unit_of_measurement": null, "state": { "entity_id": "switch.landscape_lights_switch_1", "state": "off", "attributes": { "device_class": "outlet", "icon": "mdi:lightbulb", "friendly_name": "Landscape Lights" }, "last_changed": "2023-03-06T19:38:07.211905+00:00", "last_updated": "2023-03-06T19:38:07.211905+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": "outlet", "icon": "mdi:lightbulb", "original_icon": null, "unit_of_measurement": null, "state": { "entity_id": "switch.landscape_lights_switch_2", "state": "off", "attributes": { "device_class": "outlet", "icon": "mdi:lightbulb", "friendly_name": "Riley's Run" }, "last_changed": "2023-03-06T19:38:07.084160+00:00", "last_updated": "2023-03-06T19:38:07.084160+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": null, "icon": null, "original_icon": null, "unit_of_measurement": null, "state": { "entity_id": "light.driveway", "state": "off", "attributes": { "supported_color_modes": [ "onoff" ], "friendly_name": "Driveway", "supported_features": 0 }, "last_changed": "2023-03-06T19:38:07.214775+00:00", "last_updated": "2023-03-06T19:38:07.214775+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": null, "icon": null, "original_icon": null, "unit_of_measurement": null, "state": { "entity_id": "light.riley_s_run", "state": "off", "attributes": { "supported_color_modes": [ "onoff" ], "friendly_name": "Riley's Run", "supported_features": 0 }, "last_changed": "2023-03-06T19:38:07.085238+00:00", "last_updated": "2023-03-06T19:38:07.085238+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": null, "icon": null, "original_icon": null, "unit_of_measurement": null, "state": { "entity_id": "light.landscape_lights", "state": "off", "attributes": { "supported_color_modes": [ "onoff" ], "friendly_name": "Landscape Lights", "supported_features": 0 }, "last_changed": "2023-03-06T19:38:07.215277+00:00", "last_updated": "2023-03-06T19:38:07.215277+00:00" } } ] } } }

padadof2 commented 1 year ago

I'm seeing the same error when I try to add leak detector from Tuya. The tuya integration works, but no local tuya

Sabbbe commented 1 year ago

Static address on DHCP solve that problem. Don't know how it works - just magic.