fix(cloud_api): remove unnecessary calls #513
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.