Fix thermostat rounding and Sinope polling idempotency#688
Open
Fix thermostat rounding and Sinope polling idempotency#688
Conversation
7d0dc09 to
4102263
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #688 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 62 62
Lines 10949 10953 +4
=======================================
+ Hits 10677 10681 +4
Misses 272 272 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request addresses two main issues with Sinope thermostat entities: preventing duplicate time update tasks when enabling the entity, and improving temperature setpoint precision. It also includes related test coverage and minor code improvements.
Sinope time update task management:
start_polling()to prevent duplicate time update tasks from being created whenenable()is called multiple times. This ensures only one background task is active per entity.disable()to safely remove the time update task from_tracked_tasksusingcontextlib.suppressto avoid errors if the task is already removed.test_sinope_enable_is_idempotent_for_time_update_task) to verify that enabling a Sinope thermostat multiple times does not create duplicate time update tasks.Temperature setpoint precision:
int(temperature * ZCL_TEMP)toround(temperature * ZCL_TEMP)inasync_set_temperature()to preserve decimal precision and avoid subtle setpoint drift.test_set_temperature_heat_decimal_precision) to confirm that decimal precision is maintained in setpoint conversions for heating.Minor improvements:
contextlibto support safe task removal.Failing tests addressed
tests/test_climate.py::test_set_temperature_heat_decimal_precisiontests/test_climate.py::test_sinope_enable_is_idempotent_for_time_update_taskVerification
pytest(branch-local targeted run): both tests pass.