rospogrigio / localtuya

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

All Devices Unavailable, even after reload #1449

Open hitnrun30 opened 1 year ago

hitnrun30 commented 1 year ago

The problem

Ever since the 2023.6 version of HA came out every so often, all of my Tuya Entities will all of a sudden go off line and the only way to get them to work again is the restart HA

Environment

Version core-2023.6.3 Installation Type Home Assistant Supervised Python Version 3.11.4 Operating System Family Linux Operating System Version 6.1.0-9-amd64 Host Operating System Debian GNU/Linux 12 (bookworm) Update Channel stable Supervisor Version supervisor-2023.06.4 Agent Version 1.2.2 Docker Version 24.0.2

Steps to reproduce

  1. Wait for all devices to go bad
  2. Try to reload Tuya
  3. still will not work

DP dump

Provide Home Assistant traceback/logs

`2023-07-03 11:06:10.993 WARNING (MainThread) [custom_components.localtuya.common] [ebd...gwd] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.155 WARNING (MainThread) [custom_components.localtuya.common] [880...792] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.156 WARNING (MainThread) [custom_components.localtuya.common] [483...a6b] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.158 WARNING (MainThread) [custom_components.localtuya.common] [155...36e] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.159 WARNING (MainThread) [custom_components.localtuya.common] [184...abc] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.162 WARNING (MainThread) [custom_components.localtuya.common] [573...97e] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.163 WARNING (MainThread) [custom_components.localtuya.common] [573...440] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.166 WARNING (MainThread) [custom_components.localtuya.common] [ebd...gwd] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.168 WARNING (MainThread) [custom_components.localtuya.common] [508...33e] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.170 WARNING (MainThread) [custom_components.localtuya.common] [eb2...c6a] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.173 WARNING (MainThread) [custom_components.localtuya.common] [573...426] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.176 WARNING (MainThread) [custom_components.localtuya.common] [274...ba3] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.178 WARNING (MainThread) [custom_components.localtuya.common] [370...922] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.180 WARNING (MainThread) [custom_components.localtuya.common] [ebe...49f] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.182 WARNING (MainThread) [custom_components.localtuya.common] [560...426] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.184 WARNING (MainThread) [custom_components.localtuya.common] [573...64f] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.186 WARNING (MainThread) [custom_components.localtuya.common] [370...c81] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.191 WARNING (MainThread) [custom_components.localtuya.common] [573...ca3] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.194 WARNING (MainThread) [custom_components.localtuya.common] [573...50d] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.196 WARNING (MainThread) [custom_components.localtuya.common] [560...758] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.197 WARNING (MainThread) [custom_components.localtuya.common] [483...9c8] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.198 WARNING (MainThread) [custom_components.localtuya.common] [370...fac] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.199 WARNING (MainThread) [custom_components.localtuya.common] [573...98a] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.200 WARNING (MainThread) [custom_components.localtuya.common] [508...8de] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.201 WARNING (MainThread) [custom_components.localtuya.common] [370...c77] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.202 WARNING (MainThread) [custom_components.localtuya.common] [184...b58] Disconnected - waiting for discovery broadcast 2023-07-03 11:17:26.204 WARNING (MainThread) [custom_components.localtuya.common] [eba...cxu] Disconnected - waiting for discovery broadcast 2023-07-03 11:18:55.380 WARNING (MainThread) [custom_components.localtuya.common] [eb2...c6a] Disconnected - waiting for discovery broadcast 2023-07-03 11:18:55.993 WARNING (MainThread) [custom_components.localtuya.common] [eba...cxu] Disconnected - waiting for discovery broadcast 2023-07-03 11:19:06.668 WARNING (MainThread) [custom_components.localtuya.common] [eb2...c6a] Disconnected - waiting for discovery broadcast 2023-07-03 11:26:43.986 WARNING (MainThread) [custom_components.localtuya.common] [ebd...gwd] Disconnected - waiting for discovery broadcast

Additional information

I just want it so that the integration can be reloaded

smithbill17 commented 1 year ago

Yes, this seems to be the issue I've started noticing recently (HomeAssistant v2023.6.3). Multiple devices just seem to go 'unavailable' all at once, but not all devices. The log doesn't seem to add a lot of detail:

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:255
Integration: LocalTuya integration ([documentation](https://github.com/rospogrigio/localtuya/), [issues](https://github.com/rospogrigio/localtuya/issues))
First occurred: 00:57:33 (687 occurrences)
Last logged: 06:37:30

[046...1d9] Failed to connect to 192.168.68.123: [Errno 104] Connect call failed ('192.168.68.123', 6668)
[778...03e] Failed to connect to 192.168.68.161: [Errno 104] Connect call failed ('192.168.68.161', 6668)
[765...418] Failed to connect to 192.168.68.121: [Errno 104] Connect call failed ('192.168.68.121', 6668)
[bf9...edy] Failed to connect to 192.168.68.120: [Errno 113] Connect call failed ('192.168.68.120', 6668)
[bfd...zma] Failed to connect to 192.168.68.115: [Errno 113] Connect call failed ('192.168.68.115', 6668)

However, I have noticed I can go to my 'secondary' HomeAssistant installation (on an rpi2b) which uses the 'official' Tuya Integration, where the unavailable devices (SmartPlugs) are showing as available. If I switch the device on in the official Tuya integration, then on my main HomeAssistant using LocalTuya, the previously unavailable device suddenly becomes available again.

Also, if I use the SmartLife app & toggle the unavailable devices on/off, then it also results in the LocalTuya device springing back to life.

hitnrun30 commented 12 months ago

Yes, this seems to be the issue I've started noticing recently (HomeAssistant v2023.6.3). Multiple devices just seem to go 'unavailable' all at once, but not all devices. The log doesn't seem to add a lot of detail:

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:255
Integration: LocalTuya integration ([documentation](https://github.com/rospogrigio/localtuya/), [issues](https://github.com/rospogrigio/localtuya/issues))
First occurred: 00:57:33 (687 occurrences)
Last logged: 06:37:30

[046...1d9] Failed to connect to 192.168.68.123: [Errno 104] Connect call failed ('192.168.68.123', 6668)
[778...03e] Failed to connect to 192.168.68.161: [Errno 104] Connect call failed ('192.168.68.161', 6668)
[765...418] Failed to connect to 192.168.68.121: [Errno 104] Connect call failed ('192.168.68.121', 6668)
[bf9...edy] Failed to connect to 192.168.68.120: [Errno 113] Connect call failed ('192.168.68.120', 6668)
[bfd...zma] Failed to connect to 192.168.68.115: [Errno 113] Connect call failed ('192.168.68.115', 6668)

However, I have noticed I can go to my 'secondary' HomeAssistant installation (on an rpi2b) which uses the 'official' Tuya Integration, where the unavailable devices (SmartPlugs) are showing as available. If I switch the device on in the official Tuya integration, then on my main HomeAssistant using LocalTuya, the previously unavailable device suddenly becomes available again.

Also, if I use the SmartLife app & toggle the unavailable devices on/off, then it also results in the LocalTuya device springing back to life.

I've gone into the app and tried that. The app is fine but no matter what it only a restart of HA will bring them back up

cbarth3 commented 11 months ago

I am seeing the same issue with my Tuya devices going offline over time. I try and reload and then it states failed to unload please restart HA to finish. I have even tried just doing a quick configure and click through the menus like I was setting it up for the first time to see if that would help and same thing.

I noticed in my logs that it is giving failed to connect for a device I do not have any longer 2023-07-10 15:39:18.437 WARNING (MainThread) [custom_components.localtuya.common] [eb2...mjm] Failed to connect to 192.168.10.189: [Errno 113] Connect call failed ('192.168.10.189', 6668)

test-user-101 commented 11 months ago

Hi , I have the same issue , the devices which appear to be offline on tuya local are reachable ( pingable ) locally, and can be accessed via the tuya official integration and via tuya smart home application, and whenever I presse a button the device can be controlled via local tuya for few moments and then it goes offline again , I am a new home assistant user and I just want to know if such behaviour appeared before or is it something recent ( just updated to smart home version 23.7.1 I wonder if it could be a compatibly issue ).

karolzamosc commented 11 months ago

Hi,

I have the same problem, but only in localtuya integration, official tuya integration works fine...

Home Assistant 2023.7.2 Supervisor 2023.07.1 Operating System 10.3

plandregan commented 11 months ago

Going to add my setup to the list too. A reload gets them going for a few mins. Then the data hangs. Then eventually goes unavailable.

If I have the official tuya app running on a device in the network, assuming always polling my DIN rail switches then LocalTuya keeps them updated fine.

Issue maybe lies in a keepalive to each device every 10seconds or so.

CobraDunn commented 11 months ago

I have the identical issue. There must be some commonality. My devices start dropping about every other day. Attempting to reload the integration results in the "unable to reload, please restart" message. The first restart recovers the devices about 75% of the time. 25% of time a second restart is required.

karolzamosc commented 11 months ago

I deleted all devices and add them again and all of them started working properly but after that if I want to reconfigure recently added device I got error: "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect" - but the device works properly...

paulius2k commented 11 months ago

I have been having the same problem for a long time with my Ledvance smart plugs.

Many similar tickets have been registered previously, just not sure if the sources of the problem were all the same, as some of the tickets have last comments saying the the problem has been fixed, so it's hard to say if the issues re-appeared, or now we have a different reason. E.g.:

1268

1258

1259

plandregan commented 11 months ago

Sadly ive now abandoned this.

Moved to MakeALl TuyaLocal. Working 100% solid, with 3.3, 3.4 & 3.5 devices

On Fri, 28 Jul 2023 at 09:39, paulius2k @.***> wrote:

I have been having the same problem for a long time with my Ledvance smart plugs.

Many similar tickets have been registered previously, just not sure if the sources of the problem were all the same, as some of the tickets have last comments saying the the problem has been fixed, so it's hard to say if the issues re-appeared, or now we have a different reason. E.g.:

1268 https://github.com/rospogrigio/localtuya/issues/1268

1258 https://github.com/rospogrigio/localtuya/issues/1258

1259 https://github.com/rospogrigio/localtuya/issues/1259

— Reply to this email directly, view it on GitHub https://github.com/rospogrigio/localtuya/issues/1449#issuecomment-1655283968, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FHAFRD7MIIYECACFYIIL3XSN3FZANCNFSM6AAAAAAZ4TWWJQ . You are receiving this because you commented.Message ID: @.***>

--

Check out Octopus Energy unique smart tariff's, Agile, Go, Intelligent .

If you like the sound of it please use my referral link to sign up

We both get £50 if you do!

https://share.octopus.energy/nice-pup-726

test-user-101 commented 11 months ago

Hi ,

What's "MakeALl TuyaLocal" ? Can you please share a link if possible, thanks .

Regards, Mohammed Tel : 39998497

On Fri, Jul 28, 2023, 16:08 plandregan @.***> wrote:

Sadly ive now abandoned this.

Moved to MakeALl TuyaLocal. Working 100% solid, with 3.3, 3.4 & 3.5 devices

On Fri, 28 Jul 2023 at 09:39, paulius2k @.***> wrote:

I have been having the same problem for a long time with my Ledvance smart plugs.

Many similar tickets have been registered previously, just not sure if the sources of the problem were all the same, as some of the tickets have last comments saying the the problem has been fixed, so it's hard to say if the issues re-appeared, or now we have a different reason. E.g.:

1268 https://github.com/rospogrigio/localtuya/issues/1268

1258 https://github.com/rospogrigio/localtuya/issues/1258

1259 https://github.com/rospogrigio/localtuya/issues/1259

— Reply to this email directly, view it on GitHub < https://github.com/rospogrigio/localtuya/issues/1449#issuecomment-1655283968>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/A2FHAFRD7MIIYECACFYIIL3XSN3FZANCNFSM6AAAAAAZ4TWWJQ>

. You are receiving this because you commented.Message ID: @.***>

--

Check out Octopus Energy unique smart tariff's, Agile, Go, Intelligent .

If you like the sound of it please use my referral link to sign up

We both get £50 if you do!

https://share.octopus.energy/nice-pup-726

— Reply to this email directly, view it on GitHub https://github.com/rospogrigio/localtuya/issues/1449#issuecomment-1655658636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG2UBOJ4YM63GVPFAZYQAALXSO2V7ANCNFSM6AAAAAAZ4TWWJQ . You are receiving this because you commented.Message ID: @.***>

karolzamosc commented 11 months ago

@test-user-101: https://github.com/make-all/tuya-local

CobraDunn commented 11 months ago

Sadly ive now abandoned this. Moved to MakeALl TuyaLocal. Working 100% solid, with 3.3, 3.4 & 3.5 devices On Fri, 28 Jul 2023 at 09:39, paulius2k @.> wrote: I have been having the same problem for a long time with my Ledvance smart plugs. Many similar tickets have been registered previously, just not sure if the sources of the problem were all the same, as some of the tickets have last comments saying the the problem has been fixed, so it's hard to say if the issues re-appeared, or now we have a different reason. E.g.: #1268 <#1268> #1258 <#1258> #1259 <#1259> — Reply to this email directly, view it on GitHub <#1449 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FHAFRD7MIIYECACFYIIL3XSN3FZANCNFSM6AAAAAAZ4TWWJQ . You are receiving this because you commented.Message ID: @.> -- Check out Octopus Energy unique smart tariff's, Agile, Go, Intelligent . If you like the sound of it please use my referral link to sign up We both get £50 if you do! https://share.octopus.energy/nice-pup-726

I had no idea this even existed. Thanks for sharing. I'll give it a try.

plandregan commented 11 months ago

https://github.com/make-all/tuya-local

On Fri, 28 Jul 2023 at 15:07, test-user-101 @.***> wrote:

Hi ,

What's "MakeALl TuyaLocal" ? Can you please share a link if possible, thanks .

Regards, Mohammed Tel : 39998497

On Fri, Jul 28, 2023, 16:08 plandregan @.***> wrote:

Sadly ive now abandoned this.

Moved to MakeALl TuyaLocal. Working 100% solid, with 3.3, 3.4 & 3.5 devices

On Fri, 28 Jul 2023 at 09:39, paulius2k @.***> wrote:

I have been having the same problem for a long time with my Ledvance smart plugs.

Many similar tickets have been registered previously, just not sure if the sources of the problem were all the same, as some of the tickets have last comments saying the the problem has been fixed, so it's hard to say if the issues re-appeared, or now we have a different reason. E.g.:

1268 https://github.com/rospogrigio/localtuya/issues/1268

1258 https://github.com/rospogrigio/localtuya/issues/1258

1259 https://github.com/rospogrigio/localtuya/issues/1259

— Reply to this email directly, view it on GitHub <

https://github.com/rospogrigio/localtuya/issues/1449#issuecomment-1655283968>,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/A2FHAFRD7MIIYECACFYIIL3XSN3FZANCNFSM6AAAAAAZ4TWWJQ>

. You are receiving this because you commented.Message ID: @.***>

--

Check out Octopus Energy unique smart tariff's, Agile, Go, Intelligent .

If you like the sound of it please use my referral link to sign up

We both get £50 if you do!

https://share.octopus.energy/nice-pup-726

— Reply to this email directly, view it on GitHub < https://github.com/rospogrigio/localtuya/issues/1449#issuecomment-1655658636>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AG2UBOJ4YM63GVPFAZYQAALXSO2V7ANCNFSM6AAAAAAZ4TWWJQ>

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/rospogrigio/localtuya/issues/1449#issuecomment-1655751419, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FHAFQW7AHRTJN2JTFDGALXSPBTRANCNFSM6AAAAAAZ4TWWJQ . You are receiving this because you commented.Message ID: @.***>

--

Check out Octopus Energy unique smart tariff's, Agile, Go, Intelligent .

If you like the sound of it please use my referral link to sign up

We both get £50 if you do!

https://share.octopus.energy/nice-pup-726

paulius2k commented 11 months ago

Sadly ive now abandoned this. Moved to MakeALl TuyaLocal. Working 100% solid, with 3.3, 3.4 & 3.5 devices

thank you @plandregan! I have moved to this integration as well and so far there were no issues.

stamandr commented 11 months ago

This integration is no better than rospogrigio/localtuya. I'm only able to add a third of my devices. There has to be something better that works....

m3tc0n commented 10 months ago

I have the same problem lately. My shutter switches are unreachable every time. I have now fixed my switches to access points and the problem seems to be solved. By the way, I have Ubiquiti access points. I am not a fan of locking devices to access points, but unfortunately it is the only solution for now.