Skip to content

v1.4.0

Choose a tag to compare

@github-actions github-actions released this 17 Feb 06:21
f9ce753

🔧 Critical Bug Fix: Error 500 During Reconfiguration + Code Structure Improvements

This release fixes HTTP 500 errors that could occur during integration configuration and reconfiguration, applying lessons learned from the Battery Devices Monitor integration. Additionally, the code structure has been refactored to follow Home Assistant best practices.

Fixed

  • Error 500 Prevention: Added comprehensive error handling throughout the config flow to prevent HTTP 500 errors
  • Empty Entity List Handling: Fixed crash when no entities are available in the domain filter
  • Safe Schema Creation: All form schema creation now wrapped in try-except blocks with safe fallback schemas
  • Robust Entity Filtering: Added error handling for individual entity filtering operations
  • Better Error Logging: Added debug and error logging throughout the config flow for easier troubleshooting

Changed

  • 🏗️ Code Structure (Best Practice): Renamed classes following professional integration standards:
    • HADailyCounterConfigFlowFlowHandler
    • HADailyCounterOptionsFlowOptionsFlowHandler
    • Consolidated both classes into single config_flow.py file (removed separate options_flow.py)
    • Matches structure used by Battery Devices Monitor and other professional integrations
  • Enhanced async_step_user() with comprehensive error handling and fallback schema
  • Enhanced async_step_another_trigger() with multiple layers of error protection:
    • Input processing wrapped in try-except
    • Entity filtering with individual error handling
    • Empty entity list detection with safe fallback
    • Schema creation with comprehensive fallback
  • Enhanced async_step_finish() with error handling and informational logging
  • Updated version to 1.4.0 in manifest.json
  • Modernized type hints to use native Python syntax (dict[str, Any] instead of Dict[str, Any])

Technical Details

  • Applied Battery Devices Monitor pattern: defensive programming with try-except blocks
  • All user input processing now safely handles exceptions
  • Empty dropdown prevention: provides safe fallback when no entities available
  • Form schema creation failures now return minimal functional schemas instead of crashing
  • Added _LOGGER for consistent debug and error logging throughout config flow
  • File structure now follows Home Assistant integration best practices with both flow handlers in single file

Who Should Upgrade?

All users should upgrade to v1.4.0 to ensure stable configuration and reconfiguration experience, especially when:

  • Adding multiple triggers to a counter
  • Using domain or text filters
  • Working with limited entity availability
  • Reconfiguring existing integrations

Installation

  1. Update via HACS or manually install v1.4.0
  2. Restart Home Assistant
  3. Configuration and reconfiguration should now work smoothly without 500 errors