Skip to content

Releases: sillymoi/homeassistant-infometric

Hardening and robustness improvments

30 Oct 17:54

Choose a tag to compare

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.ok usage (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: average and prognosis fields converted to float with fallbacks for empty/malformed values
  • Guard clauses: Protects against empty LastOKValues arrays (prevents IndexError)
  • 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_info property so all sensors appear under one "Infometric Panorama" device
  • Correct state classes:
    • Daily totals: SensorStateClass.TOTAL with device class
    • Monthly average/prognosis: SensorStateClass.MEASUREMENT without device class (to avoid HA validation warnings)
  • Null-safe value retrieval: Returns None gracefully if coordinator data or entries are missing

Config Flow Enhancements

  • Duplicate prevention: Checks if same URL + username already configured and aborts with already_configured reason
  • URL validation: Normalizes URLs and validates they start with http
  • Error differentiation: Uses auth_failed for authentication errors (instead of generic cannot_connect)
  • Import step: Added async_step_import for YAML-based configuration (though deprecated)

Infrastructure

  • Proper logging: Fixed _LOGGER import in __init__.py
  • Clean unload: Removes config entry data from hass.data on 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

14 Jul 12:42
6923486

Choose a tag to compare

  • 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