Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,55 @@ All notable changes to HA Daily Counter will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2026-02-17

### 🔧 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:
- `HADailyCounterConfigFlow` → `FlowHandler`
- `HADailyCounterOptionsFlow` → `OptionsFlowHandler`
- 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

## [1.3.9] - 2025-12-11

### ✨ New Feature: Counter Reconfiguration via Options Flow
Expand Down
Loading