Skip to content

v1.2.13-beta.3

Pre-release
Pre-release

Choose a tag to compare

@alexdelprete alexdelprete released this 24 Feb 21:11
v1.2.13-beta.3
d8ca361

Release v1.2.13-beta.3

GitHub Downloads

Release Date: 2026-02-24

Type: Beta release - Fixes consumed energy sensor freezing when production stops.

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

Fixed

  • energia_consumata freezes when production stops - The consumed energy sensor
    (energia_consumata = auto_consumata + prelevata) was locked inside the sync guard
    alongside energia_auto_consumata. When PV production stops (evening/night),
    energia_prodotta and energia_immessa stop changing, so the sync guard stays closed.
    But energia_prelevata (import from grid) keeps growing every poll. The consumed sensor
    froze because it was never recalculated, even though one of its inputs kept changing.

    Fix: Move energia_consumata calculation outside the sync guard so it is always
    recalculated on every poll. energia_auto_consumata stays inside the guard (it needs
    oscillation protection since it depends on prodotta - immessa). This is safe for
    TOTAL_INCREASING because both addends (auto_consumata and prelevata) are
    monotonically non-decreasing, so their sum can never dip.

  • Debug log spam during nighttime - The "waiting for sync" debug message fired on every
    idle poll (neither sensor fresh), producing unnecessary log entries outside production hours.
    Now it only fires when one sensor is actually fresh and we're waiting for the other.

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

Testing Focus

After deploying this update:

  1. Overnight test (critical): Monitor sensor.alfa_energy_consumed after sunset.
    It should keep increasing as grid import (sensor.alfa_energy_imported) grows.
  2. Energy Dashboard: Verify consumption = self-consumed + imported throughout the day.
  3. Daytime (regression check): Verify sensor.alfa_energy_self_consumed still shows
    smooth monotonic increase with no sawtooth dips.

Technical Details

  • Files changed: api.py (sync logic + docstring), test_api.py (+5 new tests,
    1 updated), energy-oscillation-fix.md (algorithm docs)
  • Test coverage: 98%
  • CI: All 3 workflows passing (Lint, Tests, Validate)

Full Changelog:
compare/v1.2.13-beta.2...v1.2.13-beta.3