Open donev77 opened 2 years ago
Same issue here after updating ha OS to last version ( 7.0 -> 7.2) Rebooting HA host again did not work. Plug works through smart life. Unplug - plug agin the device fixed the issue. Logs: This error originated from a custom integration.
Logger: custom_components.localtuya.common Source: custom_components/localtuya/pytuya/init.py:669 Integration: LocalTuya (documentation, issues) First occurred: 3:21:12 AM (32 occurrences) Last logged: 3:23:50 AM
[bf9...eyu] Connect to 192.168.0.18 failed Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 145, in _make_connection self._interface = await pytuya.connect( File "/config/customcomponents/localtuya/pytuya/init.py", line 669, in connect , protocol = await loop.create_connection( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection raise exceptions[0] File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect return await fut File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.0.18', 6668)
I'm also now getting this same issue (I think) on: Home Assistant Core v2021.12.10 LocalTuya 3.4.0
One of my Tuya SmartPlugs became 'unavailable' in HomeAssistant using LocalTuya, but it is still registered & online in the Tuya IoT Platform, can still be controlled using the 'official' Tuya Integration in HomeAssistant and also using the SmartLife app. So there is nothing wrong with the SmartPlug.
I deleted it (device & entity) from HomeAssistant and after rebooting my network & HA, attempted to re-add it to LocalTuya Integration. The 'device discovery'' dialog appears giving the correct DeviceID & IP address. I enter the correct LocalKey and after a few seconds of the 'busy wheel' the below error appears. It happens everytime. I am now unable to add this one SmartPlug to LocalTuya/HomeAssistant (other Tuya SmartPlugs in LocalTuya appear to be working normally)
2022-01-26 08:28:19 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/localtuya/config_flow.py", line 283, in async_step_basic_info
self.dps_strings = await validate_input(self.hass, user_input)
File "/config/custom_components/localtuya/config_flow.py", line 189, in validate_input
interface = await pytuya.connect(
File "/config/custom_components/localtuya/pytuya/__init__.py", line 669, in connect
_, protocol = await loop.create_connection(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
return await fut
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.68.114', 6668)
Okay - I have finally managed to re-add my SmartPlug device. My problem seems to stem from the fact I have TWO HomeAssistant installations (one on Raspberry Pi & one in a VirtualBox VM) both using LocalTuya. When the VM HA is started with all my LocalTuya SmartPlugs registered, attempting to re-add the missing SmartPlug to my RPi HA fails & results in the error above.
If I restart my VM HA, it seemingly 'releases' the SmartPlugs & I can then add it successfully to my RPi HA.
I have noticed that I have four Tuya SmartPlugs that fail to operate simultaneously in both my HomeAssistant installations - if I restart my VM HA, the SmartPlugs are available to control in my RPi HA, but appear disabled in the VM HA once it's restarted. If I do it the other way around & restart the RPi HA, then suddenly the SmartPlugs are available to control in the VM HA. So I just can't have them working in BOTH HomeAssistants simultaneously.
The only thing these 4 SmartPlugs seem to have in common, is that the SmartLife app indicates they are all on firmware v1.0.0 (and they never get auto-updated). Whereas the rest of my Tuya SmartPlugs that do work simultaneously in both HAs, are all on firmware v.1.0.3 or v1.1.2.
So clearly LocalTuya Integration has some kind of issue with Tuya SmartPlugs stuck on firmware v1.0.0 that prevents it operating in more than a single HomeAssistant installation.
This is similar to my issue: https://github.com/rospogrigio/localtuya/issues/624
The problem
Every time HA Host (HyperV) is restarted, multiple devices (power plugs) disappear (unable to connect). They come back automatically if they are unplugged and plugged back. Reload localtuya service doesn't help. Deleting/re-adding integration, worked once, the second time it kept returning "Unexpected exception" when trying to add the device. The power plugs are different models and brands.
Environment
Windows 11, Hyper V
Localtuya version: 3.3.0
Home Assistant Core version: core-2021.12.10
[] Are you using the Home Assistant Tuya Cloud component ?
[] Are you using the Tuya App in parallel ?
Steps to reproduce
Configuration
config_flow ## DP dumpconfiguration.yaml
orconfig_flow
Provide Home Assistant taceback/logs
Unplug the socket and plug it back
Additional information
The devices have good wifi signal about -74dBm reported in Smart Life app When the devices are unavailable in HA, I checked them in Smart Life app and they were working fine (power reading, status, on/off). localKey hasn't changed.