Releases: Geek-MD/HA_Daily_Counter
v1.4.1
🔧 Critical Bug Fix: OptionsFlow AttributeError
This release fixes a critical error that prevented users from accessing the options/configuration menu for existing integrations.
Fixed
- ✅ AttributeError Fix: Fixed "property 'config_entry' of 'OptionsFlowHandler' object has no setter" error
- ✅ OptionsFlow Initialization: Corrected
OptionsFlowHandler.__init__()to follow Home Assistant's OptionsFlow pattern - ✅ Configuration Access: Users can now access the options menu without errors
Technical Details
- Removed manual
config_entryparameter fromOptionsFlowHandler.__init__() - The
config_entryproperty is automatically provided by Home Assistant'sOptionsFlowbase class - Updated
async_step_init()to initialize counters fromself.config_entry.optionson first call - The
config_entryproperty is read-only and should not be assigned in__init__
Who Should Upgrade?
All users should upgrade to v1.4.1 immediately if experiencing errors when trying to configure existing integrations, especially:
- "AttributeError: property 'config_entry' of 'OptionsFlowHandler' object has no setter" errors
- HTTP 500 errors when clicking "Configure" on an integration
- Unable to add, edit, or delete counters through the options flow
Installation
- Update via HACS or manually install v1.4.1
- Restart Home Assistant
- Configuration menu should now work without errors
v1.4.0
🔧 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→FlowHandlerHADailyCounterOptionsFlow→OptionsFlowHandler- Consolidated both classes into single
config_flow.pyfile (removed separateoptions_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 ofDict[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
_LOGGERfor 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
- Update via HACS or manually install v1.4.0
- Restart Home Assistant
- Configuration and reconfiguration should now work smoothly without 500 errors
v1.3.9
✨ New Feature: Counter Reconfiguration via Options Flow
This release adds the ability to edit and reconfigure existing counters directly through the Home Assistant UI, without having to delete and recreate them.
Added
- ✨ Edit Counter Option: New "Edit counter" action in the options flow menu
- 🔄 Reconfigure Trigger Entity: Ability to change the entity that triggers the counter
- 🔄 Reconfigure Trigger State: Ability to change the state that increments the counter
- 🔄 Automatic Reload: Integration automatically reloads when configuration changes are saved
- 📋 Current Values Display: Shows current configuration before making changes in the edit flow
Changed
- Updated
__init__.pyto register an update listener that reloads the integration when options are modified - Enhanced
options_flow.pywith new edit steps:async_step_select_edit,async_step_edit_trigger_entity, andasync_step_edit_trigger_state - Updated all translation files (en.json, es.json, strings.json) with new edit-related strings
- Updated version to 1.3.9 in manifest.json
Technical Details
- Added
async_reload_entryfunction in__init__.pyto handle config entry reloads - Registered update listener in
async_setup_entryto detect option changes and trigger reload - Modified
HADailyCounterOptionsFlowclass to track editing state with_selected_edit_indexand_editing_counter - Edit flow preserves counter ID to maintain entity continuity
How to Use
- Go to Settings → Devices & Services
- Find your HA Daily Counter integration
- Click "Configure" on any existing counter entry
- Select "Edit counter" from the action menu
- Choose which counter you want to edit
- Update the trigger entity or trigger state
- The integration will automatically reload with the new configuration
v1.3.8
🔧 Critical Bug Fix Release
This release fixes the persistent migration error that continued to affect users even after v1.3.7.
Fixed
- ✅ Root Cause Fixed: Resolved persistent "Flow handler not found for entry" error by properly registering ConfigFlow with Home Assistant
- ✅ Updated
HADailyCounterConfigFlowto use modern ConfigFlow registration syntax:class HADailyCounterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN) - ✅ Added
async_migrate_entryfunction in__init__.pyfor better config entry migration handling - ✅ All existing counters now load properly after restart
- ✅ Options menu now accessible for all config entries
Who should upgrade?
All users experiencing "Flow handler not found" errors should upgrade to v1.3.8 immediately to restore full functionality.
Technical Details
- The root cause was that the ConfigFlow class used old-style domain registration (
domain = DOMAINas class attribute) instead of the modern approach (domain=DOMAINas class parameter) - In Home Assistant 2021.11+, ConfigFlow classes must register by passing domain as a parameter to the parent class
- v1.3.7 added
async_get_options_flowbut didn't fix the underlying registration issue - This fix ensures proper ConfigFlow registration with Home Assistant's flow handler registry
Installation
- Update via HACS or manually install v1.3.8
- Restart Home Assistant
- Verify all counters load properly and options menu is accessible
v1.3.7
🔧 Critical Bug Fix Release
This release fixes a critical migration error introduced in v1.3.6 that prevented existing counters from working properly.
Fixed
- ✅ Critical Migration Error: Resolved "Flow handler not found for entry" error that caused all existing counters to be disabled after upgrading to v1.3.6
- ✅ Added missing
async_get_options_flowstatic method toHADailyCounterConfigFlowclass to properly link the options flow handler - ✅ Existing config entries now work correctly and counters are no longer disabled after upgrade
Who should upgrade?
All users who upgraded to v1.3.6 should upgrade to v1.3.7 immediately to restore functionality to their existing counters.
Technical Details
- The issue occurred because Home Assistant could not find the options flow handler for existing config entries
- The
config_flow.pyhad aHADailyCounterConfigFlowclass but was missing theasync_get_options_flowstatic method - This method is required to connect the config flow to the
HADailyCounterOptionsFlowclass defined inoptions_flow.py - This fix ensures backward compatibility with existing installations
Installation
- Update via HACS or manually install v1.3.7
- Restart Home Assistant
- Your existing counters should now be enabled and working
v1.3.6
HA Daily Counter v1.3.6 — 2025-12-10
🐛 Bug Fixes
- Fixed mypy type checking error in
config_flow.pyrelated todomainparameter- Changed
domainfrom class inheritance parameter to class attribute - Resolves error: "Unexpected keyword argument 'domain' for 'init_subclass' of 'object'"
- Ensures compatibility with Python 3.11+ and mypy 1.10.0+
- Changed
🔧 Technical Changes
- Updated
HADailyCounterConfigFlowclass definition to usedomainas a class attribute instead of a class parameter - All code passes mypy type checking with zero errors
- All code passes ruff linting with zero warnings
📝 Breaking Changes
None - fully backward compatible with existing configurations
v1.3.5
HA Daily Counter v1.3.5 — 2025-12-09
🎉 New Features
- Added domain selection dropdown in configuration flow to filter entities by type (binary_sensor, sensor, automation, script, input_boolean, input_number, input_select)
- Integration now supports monitoring automations and scripts in addition to sensors
- Added text filter field in additional trigger step to search entities by name
✨ Improvements
- Moved logic operator selection (AND/OR) from first step to second step for better UX
- Logic operator now appears only when adding the first additional trigger (second sensor)
- Subsequent triggers automatically use the same logic operator
- Entity selector now dynamically filters based on selected domain type
- Optimized state lookups to avoid redundant
hass.states.get()calls
🐛 Bug Fixes
- Fixed potential AttributeError when entity state name is None
- Added null-safe handling for entity state names in trigger list
🔧 Technical Changes
- Updated translation files (en, es) with new field labels
- All code passes linting (ruff) and type checking (mypy)
- Security scan clean (CodeQL - 0 alerts)
📝 Breaking Changes
None - fully backward compatible with existing configurations
v1.3.3
HA Daily Counter v1.3.3 — 2025-11-07
Summary
Bug fixes and improvements to the configuration flow, type-stub/mypy compatibility fixes, and better compatibility with recent Home Assistant releases. Adds a single global logic selector (AND / OR) used to combine multiple triggers created during setup.
Added
- Add a logic selector (AND / OR) in the first step of the configuration flow. This value is stored in the config entry as
logicand is applied to all triggers added afterward.- Default logic:
OR.
- Default logic:
Changed
- Configuration flow behavior:
- If the "add_another" checkbox is NOT checked at any step, the flow now ends immediately and a config entry is created with the collected triggers.
- If "add_another" is checked, the flow enters a repeatable step to add more sensors until the user unchecks the box.
- The logic selector is shown only in the initial form (after the checkbox) and is not shown in the repeatable "add trigger" forms.
- Additional-triggers UI:
- For repeatable trigger-adding steps the implementation now uses a Select dropdown built from filtered entity IDs rather than attempting to pass a dynamic "options" list into
EntitySelectorConfig. - Rationale: this keeps the runtime behavior while maintaining static typing compatibility with homeassistant stubs (avoids a TypedDict error).
- For repeatable trigger-adding steps the implementation now uses a Select dropdown built from filtered entity IDs rather than attempting to pass a dynamic "options" list into
- Stored config entry data shape:
data["triggers"]now contains a list of trigger objects:{ "id": "<uuid>", "entity": "<entity_id>", "state": "<state>" }data["logic"]contains the selected logic operator:"AND"or"OR".
Fixed
- Fixed a bug where the flow did not finish and create the entry when the "add_another" box was not checked.
- Fixed multiple mypy/type-checking errors in CI:
- Removed unsupported
translation_keyarguments fromasync_show_formcalls (stubs). - Use
SelectSelectorMode.DROPDOWNinstead of bare strings for selectormode. - Avoid passing unsupported
optionskey toEntitySelectorConfig(useSelectSelectorfor dynamic lists instead). - Fixed typing around
hass.config_entries.async_forward_entry_setups/async_forward_entry_unloadsby locally casting toAnyto preserve compatibility across Home Assistant versions and avoid stub errors. - Removed unnecessary
type: ignorecomments flagged by mypy.
- Removed unsupported
Compatibility / Migration notes
- New config entries created with v1.3.3 include the
logicfield. If you have existing config entries created by earlier versions:- Integrations or code expecting
logicshould treat missinglogicasORby default. - No automatic migration tool is included in this release; if you want to backfill existing entries, update them manually or run a small migration script that sets
logic: "OR"for entries missing the field.
- Integrations or code expecting
- UI difference in repeatable trigger step:
- The repeatable step uses a dropdown (SelectSelector) of entity_ids filtered to the domain of the first selected entity and excluding already-chosen entities.
- If you prefer the EntitySelector-style autocomplete/picker for that step, it can be restored but will require either a small mypy suppression or a change to the stubs; the current approach prioritizes CI/type-safety.
Developer notes
- The following changes were made to resolve mypy issues:
- Remove
translation_keyparameter usage from calls toasync_show_form. - Use
SelectSelectorMode.DROPDOWN(enum) instead of strings. - Replace invalid
EntitySelectorConfig(options=...)usage with aSelectSelectorconstructed fromSelectOptionDictentries. - Use
cast(Any, hass.config_entries)around forward/unload entry calls to avoid typing errors with different HA versions.
- Remove
- Tests / CI:
- After applying the changes, run the pipeline locally or in CI:
- pip install mypy==1.10.0
- mypy --config-file mypy.ini
- Confirm no mypy errors remain.
- After applying the changes, run the pipeline locally or in CI:
Notes for users
- How to test the new flow:
- Install or update the custom component files and restart Home Assistant.
- Go to Settings → Integrations → Add integration → HA Daily Counter.
- Step 1 (Initial): enter Name, select first entity, select state, choose whether to Add another, and choose the logic (AND/OR, default OR).
- If you do not check "Add another", the flow should finish and create the entry immediately.
- If you check "Add another", you will see repeated forms that let you pick additional entities (filtered by domain), select state, and optionally add more.
- After finishing, review the created config entry: it will include the
triggerslist and the chosenlogic.
- Default behavior: if
logicis missing for any older config entry, treat it asOR.
Security
- No security-sensitive changes in this release.
Credits
- Changes and fixes by Geek-MD and contributors.
v1.3.2
🆕 HA Daily Counter v1.3.2
🐞 Fixes
- Fixed
hacs.jsonandmanifest.jsonto fully comply with HACS integration requirements. - Added
CONFIG_SCHEMAusingcv.config_entry_only_config_schema(DOMAIN)to satisfy Hassfest validation rules. - Reorganized imports in
__init__.pyto comply with Ruff E402 (“imports must be at the top of the file”). - Added missing import for
DOMAINincounter.py, resolving Ruff F821 (“undefined name 'DOMAIN'”). - Corrected
device_infomethod typing to match Home Assistant’sDeviceInfo | Nonestandard, ensuring Mypy passes cleanly. - Verified that all modules pass Ruff and Mypy with zero errors or warnings.
⚙️ Code Quality
- Improved consistency and readability across all modules.
- All imports sorted, typing hints added, and file headers aligned with Home Assistant best practices.
🧩 Result
The integration is now fully compliant with HACS, Hassfest, Ruff, and Mypy.
All counters and entities load correctly, historical statistics remain intact,
and users can safely upgrade without losing functionality or data.
v1.3.1
🆕 HA Daily Counter v1.3.1
🐞 Fixes
-
Fixed startup crash when loading counters
ResolvedKeyError: 'trigger_entity'caused by configurations using the newer multi-trigger format.
The integration now seamlessly supports both schemas:- Legacy schema:
trigger_entity+trigger_state - Multi-trigger schema:
triggers+logic
ensuring backward compatibility and stable migration between versions.
- Legacy schema:
-
Improved entity initialization
- Prevents crashes when configuration data is incomplete or malformed.
- Adds warnings for invalid configurations without interrupting setup.
- Guarantees that all counters correctly create and restore their entities at startup.
-
Stable restoration and reset behavior
- Keeps
state_class: total_increasingfor full statistics continuity. - Maintains historical data and state restoration after restarts.
- No unit-of-measurement changes, ensuring compatibility with recorded statistics.
- Keeps
⚙️ Code Quality
- Cleaned unused imports and validated Ruff and Mypy compliance (no warnings or errors).
- Improved defensive programming in the constructor (
__init__) for better resilience. - Preserved identical logic for counting, resetting, and daily scheduling.
🎨 Visual Updates
- Updated visual assets for improved clarity and consistency with Home Assistant:
icon.pngicon@2x.pnglogo.pnglogo@2x.png
🧩 Result
The integration is now fully stable and backward compatible.
All counters and entities load correctly, previous statistics remain intact,
and users can safely upgrade without losing history or functionality.