Skip to content

Release 2.8.0: correctness, robustness and accuracy fixes - #155

Merged
kmich merged 1 commit into
mainfrom
claude/cloudcredits-usage-o96iez
Sep 25, 2026
Merged

kmich merged 1 commit into
mainfrom
claude/cloudcredits-usage-o96iez

Conversation

@kmich

@kmich kmich commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Description

Fixes from a full code review, released as 2.8.0. The full list is in CHANGELOG.md.

Confirmed bugs

  • Stuck-sensor detection never fired, because its state lived on a dict rebuilt every cycle. It is now time-based: temperature is flagged after 4 h without moving, humidity and pressure after 6 h. Humidity near 0 % or 100 % is excluded.
  • HDD/CDD season totals: the season received the new day's first reading instead of the completed day. The CDD season also never reset, and a day that ended while Home Assistant was stopped was lost.
  • Service crash: reset_rain_baseline, reset_learning_state and export_learning_state raised AttributeError when called without entry_id. The event platform had stored a plain dict in hass.data[DOMAIN]; event entities now live on the coordinator.
  • FWI: the moisture codes got a second drying step on every intraday recompute, and the daily update ran at midnight. They now advance once, at local noon, and ISI/BUI/FWI/DSR are recomputed from the stored codes (new fwi_indices() helper).
  • Pressure-trend window: the configured window reverted to 3 h after a restart.
  • Irrigation score: it read rain-today before that value was set, so rain never offset ET₀.
  • WU/PWSWeather: dailyrainin was the rolling 24 h total; it is now rain since local midnight.
  • Hourly forecast: local readings were blended twice (coordinator + weather entity). Only the weather entity's time-aware blend remains.
  • Hourly ET₀ now follows local solar time instead of assuming 06–18 UTC. Hargreaves and Penman-Monteith use the FAO-56 daily mean temperature.
  • Vigicrues river flow was 1000× too high: Hub'Eau reports discharge (Q) in L/s.

Robustness and security

  • Background loops go through _start_periodic / _start_once. A failed run is logged and retried, and every task is cancelled on unload.
  • Repairs issue IDs are now per config entry. Legacy shared IDs are cleaned up, and an entry's issues are removed with it (async_remove_entry).
  • API keys can no longer reach the log. OWM and Pirate Weather no longer raise the URL-bearing ClientResponseError, and error messages are scrubbed.
  • The coordinator and config flow use HA's shared HTTP session.
  • The weather entity pushes forecast updates to subscribed cards.

Accuracy

  • Frost point: water-referenced humidity, inverted on the ice curve.
  • US AQI: 2024 EPA PM2.5 breakpoints, with EPA truncation.
  • The wind-speed calibration offset now also applies to gust.
  • kPa, psi and ft/s source units are converted.
  • A 0 lx reading is kept as-is instead of being treated as missing.
  • CWOP sends h00 for 100 % humidity and adds the since-midnight rain field P.

Related Issue

None. These came out of a repository-wide code review rather than a reported issue.

Motivation and Context

Several derived sensors were silently wrong (degree-day seasons, FWI, river flow, irrigation score, stuck detection), and three services crashed. A few changes alter sensor values users may compare against thresholds:

  • FWI will read higher during the day.
  • PM2.5 between 9 and 12 µg/m³ is now "Moderate" instead of "Good".
  • River flow drops by a factor of 1000.
  • Stuck-sensor Repairs issues can now appear, one per station.

How Has This Been Tested?

  • pytest tests/ on Python 3.12 with Home Assistant 2024.12.5: 420 passed. This includes 27 new regression tests in tests/test_review_fixes.py and tests/test_uploaders.py covering each fix above.
  • ruff check and ruff format --check pass on custom_components/, tests/ and scripts/.
  • scripts/validate_dashboard_entities.py passes, and the manifest/pyproject versions match.
  • Not tested against a live Home Assistant instance or the live external APIs. The Hub'Eau L/s unit was checked against its documentation.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist:

  • My code follows the code style of this project
  • I have updated the documentation accordingly (if needed)
  • I have added tests to cover my changes (if applicable)
  • All new and existing tests passed
  • I have updated CHANGELOG.md with my changes

Not in this PR: splitting _compute into tick-driven accumulation and idempotent derivation, de-duplicating the config/options flow steps, moving to entry.runtime_data, using HA-native unit conversion, and the CI workflow duplication.

…eview

Fixes stuck-sensor detection (never fired), degree-day season totals,
service crashes without entry_id, FWI double-drying and midnight timing,
the pressure-trend window resetting on restart, irrigation score ignoring
today's rain, WU/PWS daily rain, double hourly-forecast blending, ET0
timing, and river flow units (L/s). Also: entry-scoped background tasks
that survive errors, per-entry Repairs issues, API keys kept out of logs,
HA's shared HTTP session, forecast push to frontend cards, and frost
point / AQI / gust calibration / unit conversion accuracy fixes. Adds
regression tests and lints tests/ and scripts/ in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NDoSoikPAM68kMZh8WRUHf
@kmich
kmich merged commit 2b7221c into main Sep 25, 2026
10 checks passed
kmich pushed a commit that referenced this pull request Sep 25, 2026
Release 2.8.0: correctness, robustness and accuracy fixes
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.

2 participants