v1.2.13-beta.6
Pre-releaseRelease v1.2.13-beta.6
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 updatingenergia_prodottaandenergia_immessa. When
the firmware delay exceeded the poll interval, the timeout fired with staleimmessa,
producing a temporary overshoot inauto_consumata. Whenimmessacaught up on the next
timeout, the corrected (lower) value created a dip that HA'sTOTAL_INCREASINGstate class
treated as a meter reset — overcounting by the export increment on each firmware cycle.Observed symptom: Daily utility meters showed
self-consumed = productiondespite
exports occurring. The overcount was exactly equal to the daily export amount.Root cause: With
SYNC_TIMEOUT_POLLS = 2and 60s polling, the timeout could fire on
the 2nd one-fresh poll beforeimmessaupdated. The subsequent correction whenimmessa
caught up created a downward step thatTOTAL_INCREASINGmisinterpreted.Fix: Increased
SYNC_TIMEOUT_POLLSfrom 2 to 3. With the extra poll, the firmware's
immessaupdate 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 whereimmessatruly
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:
- 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 afterprodottachanges, then "both fresh" on the next. - Hourly check: Compare
hourly_autoconsumptionvshourly_production - hourly_export.
They should match (previously autoconsumption equaled production). - Daily check (next morning):
daily_autoconsumptionshould equal
daily_production - daily_export. - 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_autoconsumptionRepeat 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_POLLSconstant
Full Changelog:
compare/v1.2.13-beta.5...v1.2.13-beta.6