ollo69 / ha_tuya_custom

Tuya Custom Component for testing
Apache License 2.0
39 stars 18 forks source link

Switch status problem #16

Open matisaul opened 4 years ago

matisaul commented 4 years ago

I have some problem getting status from my switches in HA 0.113.0. I can turn on/off from HA without problem, but when I turn on/off manually from switch, I have a 30-90 seconds delay in get the status...

This is what I get from HA logs:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tuya_custom/__init__.py", line 264, in update
    self._tuya.update()
  File "/config/custom_components/tuya_custom/tuyaha/devices/switch.py", line 16, in update
    return self._update(use_discovery=True)
  File "/config/custom_components/tuya_custom/tuyaha/devices/base.py", line 36, in _update
    devices = self.api.discovery()
  File "/config/custom_components/tuya_custom/tuyaha/tuyaapi.py", line 150, in discovery
    response = self._request("Discovery", "discovery")
  File "/config/custom_components/tuya_custom/tuyaha/tuyaapi.py", line 212, in _request
    response = self.requestSession.post(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))