Closed andrus2049 closed 3 months ago
I think there are two things,
there is a timeout "5 seconds" on connecting task so it shouldn't takes long however this fix might be applied on master version not released one.
How did you disabled the the devices did you disable all the entities in that devices?
I disabled the device in HA, so all the entities pertaining to that device appear marked as disabled too. Time probably depends on how many times connection is retried.
Cause of this only device I currently disabled, the integration "inizialing" status lasts for more than 10-15 minutes, and this is a little inconvenient when adding new tuya devices, or testing/modifying their configuration, or reloading the integration itself or even rebooting HA (also the message localtuya still loading etc.... is displayed for all this time after HA reboots) After that period the following integration status is marked as Failed to set-up. After some more time finally the status returns normal ("CONFIGURE" is shown), and stay so until a configuration of any of my local connected devices is reloaded/modified, and this behavior starts over. No cloud API account configured, only ID and keys used (true local).
If possible disabled devices in HA shouldn't taken into consideration when attempting the connection (filtered/excluded in common.py?).
Ok, I got confused on different thing, I'll fix this however the fix shouldn't happen in common.py.
Many thanks, yours is the best localtuya HA integration, and I tested almost all available... Particularly I appreciated the device template export that is only available in your integration. And you keep up with the updates, which is fundamental!
Great! I manually downloaded your updated repository and copied the files onto the HA localtuya folder, then rebooted HA. Now HA boots quickly and localtuya integration startup time lasts only few seconds (for 14 devices and 53 entities). No errors!! Many thanks, problem solved!!
There is an issue in the commit https://github.com/xZetsubou/hass-localtuya/commit/34a9d9aa6161ca1f1fdd4af8d1cae1e382f644cd that if you added new device integration won't load up any more. https://github.com/xZetsubou/hass-localtuya/commit/d08e1f3068b0a5d49c89caec97b8f792e147d29d should fix it.
Ok, updated files, rebooted, all ok. I had no new device to add in this meanwhile, so I didn't get into that problem. Thanks alot again.
Devices disabled in HA by user because no longer powered or no longer connected to the wifi network or temporarily unused (seasonal device like heaters in summer and irrigation valves in winter) are in any case searched for connection repeatedly.
At HA startup and at any localtuya integration manual reload or reconfiguration this cause a very very long delay showing the integration as "initializing" and slow to react,, and eventually it might be shown as failed to setup.
If possible please exclude disabled devices to be contacted.
Example of error logged (repeated many times in the log)
common.py