Releases: sillymoi/homeassistant-infometric
Releases · sillymoi/homeassistant-infometric
Hardening and robustness improvments
Summary
This release improves the robustness, error handling, and user experience of the Infometric Panorama integration through authentication improvements, session management, config flow enhancements, and stable entity identifiers.
Changes
Authentication & API Client
- Fixed critical bug: Replaced incorrect
resp.okusage (non-existent attribute) with proper HTTP status checks (200 <= resp.status < 300) - Session reuse: Client instance is now persisted across coordinator updates to reduce server load
- Automatic re-authentication: One-time retry on API error code (e.g.,
{"result": false, "message": "5004"}) - URL normalization: Strips trailing slashes to prevent double-slash in endpoint paths
- Type safety: Added type hints throughout
InfometricClient - Better error context: Distinguishes network errors from authentication failures with specific error messages
Data Parsing & Reliability
- Safe numeric casting:
averageandprognosisfields converted tofloatwith fallbacks for empty/malformed values - Guard clauses: Protects against empty
LastOKValuesarrays (preventsIndexError) - Structured logging: Debug logs now show meter ID and name instead of raw object dumps
- Malformed entry handling: Skips unparseable meters with warnings instead of crashing
Sensor Improvements
- Stable unique IDs: Changed from
{UnitId}-{Name}_{group}_{counter}to{UnitId}_{group}_{counter}to prevent entity churn if meter names change - Device grouping: Added
device_infoproperty so all sensors appear under one "Infometric Panorama" device - Correct state classes:
- Daily totals:
SensorStateClass.TOTALwith device class - Monthly average/prognosis:
SensorStateClass.MEASUREMENTwithout device class (to avoid HA validation warnings)
- Daily totals:
- Null-safe value retrieval: Returns
Nonegracefully if coordinator data or entries are missing
Config Flow Enhancements
- Duplicate prevention: Checks if same URL + username already configured and aborts with
already_configuredreason - URL validation: Normalizes URLs and validates they start with
http - Error differentiation: Uses
auth_failedfor authentication errors (instead of genericcannot_connect) - Import step: Added
async_step_importfor YAML-based configuration (though deprecated)
Infrastructure
- Proper logging: Fixed
_LOGGERimport in__init__.py - Clean unload: Removes config entry data from
hass.dataon unload and cleans up empty domain dict - Translation keys: Added
auth_failed,already_configured,unexpected_response - Diagnostics support added: Easier troubleshooting
Backwards Compatibility
⚠️ Breaking Change: Unique ID Pattern
Impact: Existing entities will appear as new entities after upgrade; old entities become unavailable.
Old pattern: {UnitId}-{Name}_{group}_{counter} (e.g., 717-El_energy_total)
New pattern: {UnitId}_{group}_{counter} (e.g., 717_energy_total)
Migration path:
- Users upgrading will see duplicate entities initially
- They must manually delete old (unavailable) entities via Settings → Devices & Services → Entities
Why change? If Infometric renames meters (e.g., "El" → "Electricity"), the old pattern would create new entities and lose history.
Other Compatibility Notes
- Config entry data structure unchanged (no migration needed)
- No changes to entity naming (display names remain the same)
- Hourly update interval preserved
Uplift to 2025 API
- Small adaptations to the Infometric API
- Uplift to home assistant 2025.5.3
- Support for hot and cold water
- Support of HACS installation
- Removal of hardcoded meters