Skip to content

v2.0.7

Latest

Choose a tag to compare

@MrToast99 MrToast99 released this 14 Jul 17:07

v2.0.7

Bug fix plus a large internal cleanup pass. No config or entity changes — safe to update in place.

Fixed

  • Daily Import/Consumption reset to 0 on an HA restart, hours before the actual midnight reset. On the hardware-counter path, if a sensor's midnight_baseline wasn't available yet when it re-initialized after a restart, the code unconditionally set the daily total back to 0 — discarding a correctly-restored value in the process (affects breaker, panel-total, and CT daily sensors). It now derives the baseline from the already-restored total instead of wiping it, so a restart no longer loses the day's accumulated energy. Also hardened restore against Home Assistant reporting unavailable/unknown as an entity's last state, which previously failed silently.
  • Panel-total Daily Import and Daily Consumption showed identical totals on panels without working hardware energy counters (power×time fallback mode — typically firmware 2.x panels). The panel-total sensor fed the panel's raw net power into both sensors regardless of direction, since that raw value doesn't distinguish import from consumption. It now splits each breaker's power by direction (solar generation vs. everything else) using the same per-breaker classification the individual breaker-level Import/Consumption sensors already used correctly.

Internal (no user-visible behavior change intended)

Large cleanup pass across the whole integration — dead code removed, duplication reduced, nothing functional changed:

  • New shared entity base class and helper module removed ~100 duplicated lines from the entity/sensor/switch classes.
  • The daily-sensor jitter-clamp and backwards-jump guard are now shared logic between the breaker/panel and CT sensors instead of three copy-pasted implementations.
  • The panel-total Amps/Watts sensors now share one cached per-panel breaker scan instead of each independently re-scanning every breaker on every update.
  • ldata_service.py: consolidated repeated HTTP request/error-handling patterns into shared helpers, and split the large websocket connection method into smaller pieces — the timing-sensitive receive loop and reconnect logic were left untouched.
  • binary_sensor.py: the four alarm sensors (panel over/under-voltage, breaker over-current/under-voltage) collapsed into two small parameterized base classes.
  • Removed several unused imports/attributes and a never-exercised averaging mode.