rospogrigio / localtuya

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

Multi-outlet devices all turning off when turning off some #235

Open manjulapra opened 3 years ago

manjulapra commented 3 years ago

Hi,

I've configured KMC Controls 4 outlet smart plug with energy monitoring. I've configured it correctly with the correct DPs and all 3 smart switches, volt, energy, and current are reported correctly. In some instances, everything works perfectly. But, from time to time, when I switch off 1 outlet, the whole plug (all three outlets) gets turned off and the device becomes unresponsive to HA. It means I can toggle through HA, but nothing happens at the device. I have to go to Tuya app to switch on stuff again. Here is the Log entry from something I think is relevant:

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:239
Integration: LocalTuya (documentation, issues)
First occurred: 10:14:44 AM (1 occurrences)
Last logged: 10:14:44 AM

[051...71c] Failed to set DP 3 to 0
Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 183, in set_dp
    await self._interface.set_dp(state, dp_index)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 478, in set_dp
    return await self.exchange(SET, {str(dp_index): value})
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 440, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 239, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 498, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
ultratoto14 commented 3 years ago

The connection with the device has failed. Your device is unavailable, this is a know issue that will be fixed soon. See #223 and #171

postlund commented 3 years ago

@manjulapra If you could try now with master, that would be great.

manjulapra commented 3 years ago

@manjulapra If you could try now with master, that would be great.

Thanks. I am afraid I installed it using the UI and haven't installed it through Git. Grateful if somebody can point me towards a tutorial on how to do that. Thanks again for everything y'all do.

manjulapra commented 3 years ago

Updated to version 3.2 Still, when switching one of the three switches, all switches turn off. This is the log entry exactly at the same time when I was switching it off:

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:240
Integration: LocalTuya (documentation, issues)
First occurred: December 30, 2020, 9:27:34 PM (218 occurrences)
Last logged: 9:00:05 AM

[032...64a] Connect to 192.168.1.25 failed
[051...71c] Failed to set DP 3 to 0
[012...107] Connect to 192.168.1.18 failed
Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 149, in _make_connection
    status = await self._interface.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
    status = await self.exchange(STATUS)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 498, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError