Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloud_api): remove unnecessary calls #513

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

xZetsubou
Copy link
Owner

Explanation: Due to the fact that this fork contains more features, especially auto-configure entities, with the help of the Tuya API, we retrieve the devices’ DPS codes. Based on these codes, we use them to configure the entities.

Currently, each device makes “3” API calls to retrieve all the DPS codes, including the ones that are missing in the official HA Tuya integration. The main issue was that these calls would happen every time the integration loaded, which caused delays in device connection. Specifically, when the call happened in the middle of the connection process, it would slow down the connection more than it should have.

Now, the changes in #471 have made these calls much faster (0.3s or less), and they no longer affect the connection.

  • If one device is being configured, only the DPS functions of that device will be pulled.
  • If configuring multiple devices at once, all devices' DPS functions will be pulled.
  • If downloading entry diagnostics, all devices' DPS functions will be pulled.
  • If downloading diagnostics for a specific device, only that device’s DPS functions will be pulled.

related #457

this may affect issue where devices stops responses for no reason!

Concerns: I’m not entirely sure if the API attempts to connect to the devices to pull the DPS query. If it does, then this could affect users who block DNS/Internet access, although the impact should have been significantly reduced.

@xZetsubou xZetsubou merged commit 3aa37a5 into master Jan 24, 2025
2 checks passed
@xZetsubou xZetsubou deleted the remove-the-unnecessary-api-calls branch January 31, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant