Skip to content

Codex updated: Fix thermostat rounding and Sinope polling idempotency#830

Draft
dmulcahey wants to merge 2 commits into
devfrom
codex-updated-pr-688
Draft

Codex updated: Fix thermostat rounding and Sinope polling idempotency#830
dmulcahey wants to merge 2 commits into
devfrom
codex-updated-pr-688

Conversation

@dmulcahey

Copy link
Copy Markdown
Contributor

This pull request was created with Codex and is an updated version of the pull request it supersedes.

Original pull request: #688

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.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.27%. Comparing base (c38e03e) to head (7a51205).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #830   +/-   ##
=======================================
  Coverage   97.27%   97.27%           
=======================================
  Files          55       55           
  Lines       10930    10943   +13     
=======================================
+ Hits        10632    10645   +13     
  Misses        298      298           

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

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