Releases: Geek-MD/HA_Daily_Counter
v1.5.2
🔧 Bug Fix + ✨ New Features
This release fixes a critical bug introduced in earlier versions and adds two new UX features: state selection via dropdown and multi-language support.
Fixed
- ✅ No entities after initial setup:
async_step_finish()inconfig_flow.pywas storing trigger data inentry.datainstead ofentry.options. Sincesensor.py'sasync_setup_entryreads fromentry.options.get("counters", []), no entities were created after the initial config flow. The counter is now correctly stored inentry.optionsas{"counters": [{...}]}. - ✅ Backward compatibility for pre-v1.5.2 entries:
sensor.pynow falls back toentry.datawhenentry.optionshas no counters, so entries created before this fix continue to work (with a logged warning to re-create the entry for a full migration).
Added
- ✨ State selection via dropdown: The trigger state field is now a dropdown selector populated with the entity's known possible states, replacing the free-text input. Supported domains:
binary_sensor,input_boolean,switch,light,fan,lock,automation,script→on/offcover→open,closed,opening,closingalarm_control_panel→disarmed,armed_home,armed_away,armed_night,pending,triggeredinput_select→ options read from the entity'soptionsattribute at runtime- All other domains → current state of the entity shown as default option
- The selector supports
custom_value=True, so users can always type a state not in the list.
- ✨ Multi-language support: The UI now ships with translations for 5 languages:
- 🇬🇧 English (
en) - 🇪🇸 Spanish (
es) - 🇫🇷 French (
fr) — new - 🇵🇹 Portuguese (
pt) — new - 🇩🇪 German (
de) — new
- 🇬🇧 English (
Changed
- Config flow split:
async_step_first_triggernow only collects the entity; a newasync_step_first_trigger_statestep handles state selection via dropdown. - Config flow split:
async_step_another_triggernow only collects the entity and logic; a newasync_step_another_trigger_statestep handles state selection via dropdown. - Options flow
async_step_trigger_stateandasync_step_edit_trigger_statenow use the same dropdown selector instead of a plain text field. - Updated all translation files (
en,es,strings) to reflect the new step structure. - Updated version to 1.5.2 in
manifest.json.
v1.5.1
🔧 Bug Fix: Entry Unload / Reload Error (closes #34)
This release fixes two related bugs in __init__.py that caused integration unload to fail with an AttributeError and prevented sensors from appearing immediately after setup.
Fixed
- ✅ AttributeError on unload (#34):
async_forward_entry_unloads(non-existent plural form) replaced with the correctasync_forward_entry_unload(singular). This caused every reload/unload of a counter entry to fail withAttributeError: 'ConfigEntries' object has no attribute 'async_forward_entry_unloads'. - ✅ Sensor not visible after adding counter (#34):
async_setup_entrywas wrappingasync_forward_entry_setupsinhass.async_create_task, scheduling setup asynchronously without awaiting it. The call is now properly awaited so the sensor entity is registered beforeasync_setup_entryreturns, making it visible immediately without requiring a full HA restart. - ✅ Incorrect return type in unload:
all()was called on theboolresult ofasync_forward_entry_unload; replaced with a directbool()cast to satisfy the return type.
Changed
- Removed unused
castandAnyimports from__init__.py. - Updated version to 1.5.1 in
manifest.json.
v1.5.0
✨ New Feature: Attach Counter to an Existing Device (closes #34)
Counter sensors are now automatically associated with the device that owns their trigger entity. When you configure a counter whose trigger entity belongs to a physical or virtual device (e.g. a Tuya light, a Z-Wave switch, etc.), the counter sensor will appear directly on that device's page in Home Assistant instead of creating a separate virtual device entry.
Added
- ✨ Automatic device association:
device_infonow queries the entity registry and device registry at runtime. If the trigger entity is linked to an existing device, the counter sensor adopts that device's identifiers and appears alongside it in the HA UI. - ✅ Graceful fallback: If the trigger entity has no associated device (e.g. virtual helpers, template sensors), the counter falls back to the existing behaviour of creating its own virtual device entry.
Changed
- Updated version to 1.5.0 in
manifest.json. - Added
device_registryandentity_registryimports tosensor.py.
Technical Details
HADailyCounterEntity.device_infouseser.async_get(hass).async_get(entity_id)to retrieve the trigger entity'sdevice_id, thendr.async_get(hass).async_get(device_id)to fetch the fullDeviceEntryand itsidentifiers.- Both registry lookups are synchronous in-memory operations (no I/O), so they are safe to perform inside a property.
- Inspired by the approach used in ha_real-last-changed.
Credits
- 🙏 Feature requested by @alsmaison in #34.
v1.4.2
✨ New Feature: Monitor Any Entity Type + Fix Domain Filter (closes #31)
This release allows any entity domain to be used as a trigger entity, not just binary sensors, and fixes the bug where the entity selector always showed binary sensor entities regardless of the domain filter selected.
Fixed
- ✅ Domain Filter Bug (#31): The entity selector was always showing binary sensor entities even when a different entity type was selected. The root cause was that HA config flow forms are static — a domain filter dropdown and an EntitySelector cannot coexist on the same form step and keep in sync. Fixed by splitting the step into two: one for name + domain selection, and a second for entity + state selection.
Added
- ✨ Any Entity Domain as Trigger: Counters can now monitor entities from any domain:
- Binary Sensors (doors, windows, motion detectors)
- Sensors (temperature, humidity, etc.)
- Automations (track automation executions)
- Scripts (monitor script runs)
- Input Helpers (
input_boolean,input_number,input_select)
- ✨ Domain Filter in Options Flow: When adding or editing a counter via the options flow, a domain selection step is now shown before the entity selector, ensuring the correct entity type is displayed.
- ✨ Cross-Domain Additional Triggers: The "Add Another Trigger" step now uses a native EntitySelector with no domain restriction, allowing each additional trigger to reference a different entity domain.
Changed
- 🏗️ Config Flow Restructure:
async_step_usernow only collects the counter name and domain filter. A newasync_step_first_triggerhandles entity and state selection, using anEntitySelectorfiltered to the chosen domain. - 🏗️ Options Flow Restructure: Added
async_step_trigger_domain(for adding) andasync_step_edit_trigger_domain(for editing) steps before entity selection. - 🧹 Simplified
another_triggerStep: Replaced the complex server-side entity list builder (customSelectSelector) and text filter with a nativeEntitySelectorthat supports all entity types and has built-in search. - Updated all translation files (en.json, es.json, strings.json) with new step titles and descriptions.
- Updated version to 1.4.2 in manifest.json.
Technical Details
- HA config flow forms are rendered statically: changing a dropdown value does not dynamically update other selectors on the same form. The fix separates domain selection and entity selection into consecutive steps.
EntitySelectorwithdomain=[selected_domain]is now created on a fresh step after the domain is already known, guaranteeing the correct entity list is shown.- The
TextSelectortext filter inanother_triggerhas been removed;EntitySelectorprovides built-in search/filter natively in the HA frontend.
Who Should Upgrade?
All users should upgrade to v1.4.2 if experiencing:
- Entity selector always showing binary sensor entities regardless of domain selection
- Inability to configure non-binary-sensor entities as triggers
Installation
- Update via HACS or manually install v1.4.2
- Restart Home Assistant
- New counters can now be configured with any supported entity type
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