rospogrigio / localtuya

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

Q: how to disable a device #1151

Open pergolafabio opened 1 year ago

pergolafabio commented 1 year ago

Guys , just a quick question, when a device is offline on purpose, the log gets flooded like below... I thought disabling the device in the integration should get rid of the flooding, but it doesnt... How can we stop the flooding?

2022-11-28 18:28:35.831 ERROR (MainThread) [custom_components.localtuya.common] [bf9...eip] Connect to 192.168.0.67 failed
Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 186, in _make_connection
    self._interface = await pytuya.connect(
  File "/config/custom_components/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.0.67', 6668)
dabbler68 commented 1 year ago

I have the same issue when devices are unplugged (I don't disable them). The same multiple lines repeat every minute. I think a warning message for a device not detected would be good, but not every minute. Meross LAN provides a single line warning every 4 hours.

Is there a setting that would help?