rospogrigio / localtuya

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

Unexpected exception when adding Calex contact sensor #208

Open smithbill17 opened 4 years ago

smithbill17 commented 4 years ago

When I try to manually add a Calex contact sensor device (automatic detection doesn't find it even though its in SmartLife and working and the device is Tuya capable), i get this exception error:

Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/pytuya/__init__.py:626
Integration: LocalTuya integration (documentation, issues)
First occurred: 12:42:51 (1 occurrences)
Last logged: 12:42:51

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/localtuya/config_flow.py", line 260, in async_step_basic_info
    self.dps_strings = await validate_input(self.hass, user_input)
  File "/config/custom_components/localtuya/config_flow.py", line 166, in validate_input
    interface = await pytuya.connect(
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 626, 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}')
OSError: [Errno 113] Connect call failed ('192.168.8.xxx', 6668)
ultratoto14 commented 3 years ago

The sensors are not yet supported in this integration, only the devices that supports full time connections. The sensors as, contact or PIR only connects to wifi when value changes and so the integration is not able to connect to them.