Skip to content

v1.2.13-beta.5

Pre-release
Pre-release

Choose a tag to compare

@alexdelprete alexdelprete released this 25 Feb 10:16
v1.2.13-beta.5
6a7c424

Release v1.2.13-beta.5

GitHub Downloads

Release Date: 2026-02-25

Type: Beta release - Fixes cross-midnight timing artifact in self-consumption utility meters.

What's Changed (since v1.2.13-beta.4)

Fixed

  • Cross-midnight timing artifact in energia_auto_consumata - The sync guard
    that prevents oscillation double-counting (introduced in beta.1) would freeze
    auto_consumata at its last calculated value when production stops at sunset.
    If any residual gap existed between auto_consumata and prodotta - immessa
    at that point, it persisted overnight and got attributed to the next day when
    production resumed. This caused daily utility meters to show
    self-consumed = production despite exports occurring.

    Root cause: The "neither changed" branch of the sync guard correctly reset the
    unsync counter but did not check whether the calculated value was still aligned
    with the current base sensor values.

    Fix: Added quiescent reconciliation — when both prodotta and immessa stop
    changing (quiescent period), force-align auto_consumata with prodotta - immessa.
    This is safe because zero sensor activity means zero oscillation risk. The
    reconciliation fires within 60 seconds of both sensors going idle (typically at
    sunset), giving hours of margin before the midnight utility meter boundary.

    A tolerance of 0.001 kWh prevents spurious triggers from floating-point rounding.

Bug Fix History (v1.2.13 beta series)

Beta Bug Root Cause
beta.1 Over-counting in calculated energy sensors Desynchronized prodotta - immessa calculation
beta.2 Idle polls poisoned sync counter else branch didn't distinguish "one fresh" from "neither fresh"
beta.3 Consumed energy freezes at night energia_consumata locked inside sync guard
beta.4 (no bug fix — ModbusLink 1.5.1 upgrade) (dependency update)
beta.5 Cross-midnight timing artifact Sync guard held stale value during quiescent period

Testing Focus

After deploying this update:

  1. After sunset: Monitor sensor.alfa_energy_self_consumed. It should reconcile
    to match produced - exported within 1-2 polls of both sensors going idle.
    Look for the debug log: "Quiescent reconciliation: aligned auto_consumata".
  2. Next morning: Check daily utility meters. daily_autoconsumption should equal
    daily_production - daily_export (previously showed autoconsumption = production).
  3. Daytime (regression check): Verify no oscillation in sensor.alfa_energy_self_consumed
    during peak solar hours.

Technical Details

  • Files changed: api.py (+10 lines in sync guard), test_api.py (+8 new tests),
    energy-oscillation-fix.md (algorithm docs)
  • No new constants or instance variables — the reconciliation uses existing tracking state
  • CI: All 3 workflows passing (Lint, Tests, Validate)

Full Changelog:
compare/v1.2.13-beta.4...v1.2.13-beta.5