Skip to content

v1.2.13-beta.6

Pre-release
Pre-release

Choose a tag to compare

@alexdelprete alexdelprete released this 25 Feb 10:48
v1.2.13-beta.6
98c1013

Release v1.2.13-beta.6

GitHub Downloads

Release Date: 2026-02-25

Type: Beta release - Fixes daily autoconsumption overcounting by increasing sync guard timeout.

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

Fixed

  • Daily autoconsumption overcounting by exactly the export amount - The sync guard timeout
    (SYNC_TIMEOUT_POLLS) was set to 2 polls (120s), which was too aggressive for the Alfa
    firmware's ~60s delay between updating energia_prodotta and energia_immessa. When
    the firmware delay exceeded the poll interval, the timeout fired with stale immessa,
    producing a temporary overshoot in auto_consumata. When immessa caught up on the next
    timeout, the corrected (lower) value created a dip that HA's TOTAL_INCREASING state class
    treated as a meter reset — overcounting by the export increment on each firmware cycle.

    Observed symptom: Daily utility meters showed self-consumed = production despite
    exports occurring. The overcount was exactly equal to the daily export amount.

    Root cause: With SYNC_TIMEOUT_POLLS = 2 and 60s polling, the timeout could fire on
    the 2nd one-fresh poll before immessa updated. The subsequent correction when immessa
    caught up created a downward step that TOTAL_INCREASING misinterpreted.

    Fix: Increased SYNC_TIMEOUT_POLLS from 2 to 3. With the extra poll, the firmware's
    immessa update is caught on poll N+1 as "both fresh" (correct synchronized calculation),
    and the timeout only fires on poll N+2 for genuine no-export periods where immessa truly
    isn't changing.

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
beta.6 Autoconsumption = production Timeout too aggressive, TOTAL_INCREASING dip overcounting

Testing Focus

After deploying this update:

  1. During peak solar hours: Monitor sensor.alfa_energy_self_consumed. It should increase
    smoothly without sawtooth dips. The debug log should show "Waiting for synchronized base
    sensor update" on the first poll after prodotta changes, then "both fresh" on the next.
  2. Hourly check: Compare hourly_autoconsumption vs hourly_production - hourly_export.
    They should match (previously autoconsumption equaled production).
  3. Daily check (next morning): daily_autoconsumption should equal
    daily_production - daily_export.
  4. After deploying: Calibrate utility meters to correct today's accumulated overcount
    (see calibration values below).

Post-Deploy Calibration

After installing beta.6, calibrate the autoconsumption utility meters using the values from
production - export at the time of calibration. Use Developer Tools > Services:

service: utility_meter.calibrate
data:
  value: "<production_minus_export>"
target:
  entity_id: sensor.daily_energy_autoconsumption

Repeat for weekly, monthly, and yearly meters.

Technical Details

  • Files changed: const.py (timeout value), api.py (comment), CLAUDE.md (docs),
    energy-oscillation-fix.md (algorithm docs)
  • No new instance variables or logic branches — only the timeout constant changed
  • Tests automatically adapt — they use the SYNC_TIMEOUT_POLLS constant

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