Skip to content

Fix thermostat rounding and Sinope polling idempotency#688

Open
dmulcahey wants to merge 1 commit intodevfrom
pr/fix-climate-rounding-sinope-polling
Open

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

Conversation

@dmulcahey
Copy link
Contributor

@dmulcahey dmulcahey commented Feb 27, 2026

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
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (9d03d63) to head (4102263).

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.
📢 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.

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