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

Refactor async_update to use asyncio #37

Merged
merged 6 commits into from
Mar 12, 2024
Merged

Refactor async_update to use asyncio #37

merged 6 commits into from
Mar 12, 2024

Conversation

Pho3niX90
Copy link
Owner

@Pho3niX90 Pho3niX90 commented Mar 9, 2024

The async_update method in the solis_modbus sensor has been refactored to utilize asyncio for entity updates. Instead of using simple loops to call the update method on each entity, asyncio.gather and asyncio.to_thread are used to make the update calls asynchronously. This change should improve the efficiency of the update method, reducing the time taken and resources used.

fixes: #27
fixes #38

pre-release: https://github.com/Pho3niX90/solis_modbus/releases/tag/1.4.0-beta-02

The `async_update` method in the solis_modbus sensor has been refactored to utilize asyncio for entity updates. Instead of using simple loops to call the update method on each entity, asyncio.gather and asyncio.to_thread are used to make the update calls asynchronously. This change should improve the efficiency of the update method, reducing the time taken and resources used.
The `async_update` method in the solis_modbus sensor has been refactored to utilize asyncio for entity updates. Instead of using simple loops to call the update method
…itionally, a new function has been introduced to test for clock drift by comparing the inverter time with the system time.
The if conditions for logging time drift in the solis_modbus sensor have been refactored into a clearer, more readable structure with elif and else conditions. This improves clarity of the code, making it simpler to decipher at a glance.
The time drift conditions now use 'total_drift', which is calculated by summing the drift in hours, minutes, and seconds. This change enhances the clarity and readability of the code in the solis_modbus component.
@Pho3niX90 Pho3niX90 merged commit e15e551 into master Mar 12, 2024
6 checks passed
@Pho3niX90 Pho3niX90 deleted the feature/async branch March 12, 2024 21:15
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.

Unit maybe wrong Solis Active Power Slowdown of home assistant
1 participant