Closed carlosCastro99 closed 3 years ago
Yeah sorry guys, I made some mess, please downgrade back to 3.0.1 and wait for localtuya to be added into HACS natively. Thank you
Hi guys, firstly, thanks for getting this going. It's looking very promising!
Not sure if this is related, but I downgraded, and now my device is not showing up anymore. It is not discovering automatically, and when added manually and via yaml, the following error is thrown:
Connect to 192.168.1.134 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 151, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 429, in status
if "dps" in status:
TypeError: argument of type 'NoneType' is not iterable
localtuya:
- host: 192.168.1.134
device_id: xxx
local_key: xxx
friendly_name: Bedroom Humidifier
protocol_version: "3.3"
entities:
- platform: switch
friendly_name: Bedroom Humidifier Switch
id: 1
- platform: light
friendly_name: Bedroom Humidifier Light
id: 11
edit: saw this come up too
Connect to 192.168.1.134 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 141, in _make_connection
self._interface = await pytuya.connect(
File "/config/custom_components/localtuya/pytuya/__init__.py", line 593, 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 494, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionResetError: [Errno 104] Connect call failed ('192.168.1.134', 6668)
@sabellwind I have seen that issue as well, I think the device decides to close the connection. I will commit a workaround for it.
Hi @postlund I managed to trace the issue in this instance to TuyaGateway running at the same time. I was experimenting with it but gave up after I came across this more simply put together integration. It was configured with the device ID, virtual key and IP, but not much more than that.
Seems as if adding the device won't work if it's actively being engaged by another platform, (tuya, TuyaGateway etc.)
Thanks for following up
@sabellwind that sounds very reasonable. Some (most) devices only accept one connection at the time.
Should be fixed now.
it seems that the last update has a bug. it's writing files in directory /config/custom_components/localtuya/custom_components/localtuya. Had to move them manually.