Skip to content

v1.5.0 - Code Quality & Resilience

Choose a tag to compare

@atacamalabs atacamalabs released this 12 Feb 11:43
· 19 commits to main since this release

πŸŽ‰ Major Release: Code Quality & Resilience

v1.5.0 brings significant improvements to make Serac more reliable, debuggable, and maintainable.


✨ What's New

πŸ”„ Error Retry Logic with Exponential Backoff

Serac now automatically retries failed API calls with intelligent backoff:

How it works:

  • First attempt fails β†’ Wait 1s, retry
  • Second attempt fails β†’ Wait 2s, retry
  • Third attempt fails β†’ Wait 4s, retry
  • After 4 total attempts β†’ Report failure

Smart error handling:

  • βœ… Retries on: Network errors, timeouts, 5xx server errors
  • ❌ No retry on: 401 (auth), 403 (forbidden), 404 (not found)

Impact:

  • Before: Single network hiccup β†’ Update fails β†’ Wait 1 hour for next try
  • Now: Network hiccup β†’ Automatic recovery β†’ Success!

Applies to:

  • All weather API calls (current, daily, hourly, air quality)
  • All avalanche bulletin calls (BRA)

πŸ“Š Enhanced Logging with Timing & Context

Every coordinator update now includes rich information:

Example logs:

INFO: Weather update completed for home in 1.23s: 8 daily forecasts, 48 hourly forecasts, available air quality
DEBUG: Weather data details for home: elevation=1035m, 6h forecasts=6, current_temp=2.5Β°C

INFO: BRA update completed for Aravis in 0.87s: risk_today=2, risk_tomorrow=3, bulletin_date=2026-02-12T16:00:00
DEBUG: BRA details for Aravis: altitude_limit=2000m, high_risk=MarquΓ©, low_risk=Faible

ERROR: Failed to fetch weather data for home after 5.42s (lat=46.0304, lon=6.3066): Connection timeout

What's included:

  • ⏱️ Timing information (elapsed seconds)
  • πŸ“ Location context (coordinates, massif names)
  • πŸ“ˆ Data summaries (forecast counts, risk levels)
  • πŸ” Error details (type, context, coordinates)

Benefits:

  • Identify slow API calls
  • Easier troubleshooting with context
  • Better support via detailed logs

πŸ§ͺ Comprehensive Unit Tests

Added 29 tests covering core functionality:

Test coverage:

  • βœ… Retry logic (6 tests)

    • Success on first attempt
    • Success after failures
    • Max retries behavior
    • Auth error handling (no retry)
    • Server error handling (retry)
  • βœ… AromeCoordinator (3 tests)

    • Successful weather updates
    • Updates without air quality
    • API error handling
  • βœ… BraCoordinator (3 tests)

    • Successful bulletin updates
    • Out of season handling
    • API error handling
  • βœ… Config flow (10 tests)

    • Coordinate validation
    • Prefix validation
    • Character/length rules
    • Prefix suggestions

For developers:

# Install test dependencies
pip install -r requirements_test.txt

# Run all tests
pytest tests/

# Run with coverage
pytest --cov=custom_components.serac tests/

🎯 Key Benefits

For All Users

πŸ›‘οΈ More Reliable

  • Automatic recovery from temporary network issues
  • Fewer "unavailable" sensors from transient errors
  • Robust handling of API timeouts

πŸ” Easier Debugging

  • Download diagnostics (v1.4.2+) with enhanced logs
  • Timing info helps identify performance issues
  • Context-rich error messages for support

For Developers

🧰 Better Maintainability

  • Unit tests catch regressions
  • Mock-based testing (no live API needed)
  • Foundation for CI/CD pipeline

πŸ“¦ Installation

Via HACS (Recommended)

  1. Open HACS β†’ Integrations
  2. Find Serac β†’ Click Update to v1.5.0
  3. Restart Home Assistant

Manual Installation

  1. Download from Releases
  2. Extract to config/custom_components/serac/
  3. Restart Home Assistant

πŸ”§ Technical Details

Changes

  • coordinator.py: Add retry logic + enhanced logging
  • manifest.json: Version 1.4.2 β†’ 1.5.0
  • tests/: New test suite (29 tests)
  • pytest.ini: Pytest configuration
  • requirements_test.txt: Test dependencies

Compatibility

  • βœ… No breaking changes
  • βœ… Drop-in replacement for v1.4.x
  • βœ… No config changes needed
  • βœ… All existing sensors continue working

Performance

  • Retry logic adds minimal overhead (only on failures)
  • Enhanced logging negligible impact
  • Tests don't run in production

πŸ“ˆ Stats

  • 771 lines added across 8 files
  • 29 unit tests created
  • 3 retry attempts per API call
  • 100% backward compatible

πŸ› Bug Fixes

  • Improved error handling for transient network issues
  • Better logging context prevents ambiguous errors

πŸš€ What's Next

v1.6.0 (Planned - 2-3 weeks)

  • Weather Alerts (Vigilance) - MΓ©tΓ©o-France severe weather warnings
  • Department-level alerts with color codes (Green/Yellow/Orange/Red)
  • Alert types: wind, rain/flood, thunderstorms, snow/ice, fog

See ROADMAP.md for full development plan.


πŸ™ Thank You

To all Serac users - this release focuses on reliability and quality. Your feedback helps make Serac better!

Special thanks to the Home Assistant community for development support.


Full Changelog: v1.4.2...v1.5.0

Made with ❀️ for the mountain community πŸ”οΈ