Skip to content

Fix thermostat rounding and Sinope polling idempotency - #688

Closed
dmulcahey wants to merge 1 commit into
devfrom
pr/fix-climate-rounding-sinope-polling
Closed

Fix thermostat rounding and Sinope polling idempotency#688
dmulcahey wants to merge 1 commit into
devfrom
pr/fix-climate-rounding-sinope-polling

Conversation

@dmulcahey

@dmulcahey dmulcahey commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

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:

  • Added a check in start_polling() to prevent duplicate time update tasks from being created when enable() is called multiple times. This ensures only one background task is active per entity.
  • Updated disable() to safely remove the time update task from _tracked_tasks using contextlib.suppress to avoid errors if the task is already removed.
  • Introduced a test (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:

  • Changed all setpoint conversions from int(temperature * ZCL_TEMP) to round(temperature * ZCL_TEMP) in async_set_temperature() to preserve decimal precision and avoid subtle setpoint drift.
  • Added a test (test_set_temperature_heat_decimal_precision) to confirm that decimal precision is maintained in setpoint conversions for heating.

Minor improvements:

  • Imported contextlib to support safe task removal.

Failing tests addressed

  • tests/test_climate.py::test_set_temperature_heat_decimal_precision
  • tests/test_climate.py::test_sinope_enable_is_idempotent_for_time_update_task

Verification

  • pytest (branch-local targeted run): both tests pass.

@dmulcahey
dmulcahey force-pushed the pr/fix-climate-rounding-sinope-polling branch from 7d0dc09 to 4102263 Compare February 27, 2026 16:04
@dmulcahey
dmulcahey changed the base branch from dm/codex-issue-exploration to dev February 27, 2026 16:04
@dmulcahey dmulcahey closed this Feb 27, 2026
@dmulcahey dmulcahey reopened this Feb 27, 2026
@codecov

codecov Bot commented Feb 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (9d03d63) to head (4102263).
⚠️ Report is 92 commits behind head on dev.

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 Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmulcahey

Copy link
Copy Markdown
Contributor Author

Closing as superseded by the refreshed #830. That PR retains the thermostat centidegree-rounding fix and Sinope polling lifecycle fix on current dev, with cancellation-aware updater ownership tests. Further review should continue there rather than on this older duplicate.

@dmulcahey dmulcahey closed this Sep 5, 2026
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