v1.2.13-beta.1
Pre-releaseRelease v1.2.13-beta.1
Release Date: 2026-02-23
Type: Beta release - Fixes over-counting in calculated energy sensors. Testing required.
What's Changed
Bug Fixes
-
Fixed energy over-counting in calculated sensors (
energia_auto_consumata,energia_consumata)The Alfa firmware updates
energia_prodottaandenergia_immessaregisters on a ~15-minute
internal cycle, with prodotta always updating ~1 minute before immessa. With our 60-second
polling, this causes the two values to be captured on alternating polls:- Poll N:
energia_prodottais new,energia_immessais stale - Poll N+1:
energia_immessacatches up,energia_prodottais unchanged
Calculating
prodotta - immessawhen only one has updated produces a temporary spike/dip.
HA'sTOTAL_INCREASINGstate class treats each dip as a meter reset, causing significant
over-counting on daily self-consumption and consumption values.Fix: Energy sensors are now only recalculated when both base sensors have updated since
the last calculation. A 2-poll timeout fallback handles periods when only one sensor is changing
(e.g., no-export periods). Power sensors (MEASUREMENTstate class) are always calculated
immediately as before. - Poll N:
Documentation
- Added detailed analysis document:
docs/analysis/energy-oscillation-fix.md - Updated CLAUDE.md with firmware behavior documentation
What to Validate During Beta
After installing this beta, please monitor over a full day:
sensor.alfa_energy_self_consumed— Should increase monotonically, no sawtooth oscillation- Utility meters tracking autoconsumption/consumption — Should show realistic values
- Debug logs — Enable debug logging for
custom_components.sinapsi_alfaand look for
"Skipping energy calc" messages confirming the sync logic is active during daytime - No-export periods (early morning, evening) — Verify the timeout fallback allows values
to update after 2 polls
User Action Required: Fixing Affected Sensors
Which Sensors Are Affected?
Only sensors that are derived from the two calculated Alfa sensors are affected:
sensor.alfa_energy_self_consumed(energia_auto_consumata)sensor.alfa_energy_consumed(energia_consumata)
Sensors tracking direct Modbus registers are NOT affected — production, export, and import
values from the Alfa device have always been correct.
Affected Utility Meters
If you have utility meters configured to track the calculated sensors, they will have accumulated
inflated values. Common examples:
sensor.daily_energy_consumptionsensor.daily_energy_autoconsumptionsensor.monthly_energy_consumptionsensor.monthly_energy_autoconsumption- (and any hourly, weekly, yearly, total variants)
Affected Template Sensors
If you created template sensors based on the calculated Alfa sensors, their historical values
will also be inflated.
After this fix, the source sensor values will be correct, so template sensors will automatically
produce correct future values. Historical data still needs manual correction.
How to Fix: Utility Meters
Future data is automatically correct after installing this beta — no action needed for
new readings.
To fix today's accumulated value, use the utility_meter.calibrate service:
# Example: fix daily autoconsumption meter
# Correct value = daily_production - daily_export
service: utility_meter.calibrate
data:
value: "<correct_value>"
target:
entity_id: sensor.daily_energy_autoconsumption# Example: fix daily consumption meter
# Correct value = daily_import + daily_production - daily_export
service: utility_meter.calibrate
data:
value: "<correct_value>"
target:
entity_id: sensor.daily_energy_consumptionTip: To calculate the correct value, use direct Alfa sensors that are NOT affected:
- Self-consumption = Production - Export
(sensor.alfa_energy_produced-sensor.alfa_energy_exported) - Consumption = Import + Production - Export
(sensor.alfa_energy_imported+sensor.alfa_energy_produced-sensor.alfa_energy_exported)
How to Fix: Historical Statistics (Energy Dashboard)
If your HA Energy Dashboard shows inflated historical consumption/autoconsumption:
- Go to Developer Tools > Statistics
- Search for the affected sensor (e.g.,
sensor.alfa_energy_self_consumed) - Click the adjust icon to correct individual hourly data points
- Both short-term and long-term statistics may need correction
Note: This is a manual process and only needed if you want accurate historical graphs.
Future data will be correct automatically.
How to Fix: Template Sensors
Template sensors based on calculated Alfa sensors don't need code changes — they will
automatically produce correct values going forward since the source data is now correct.
To fix their historical statistics, use the same Developer Tools > Statistics approach
described above.
Full Changelog
Full Changelog: v1.2.12...v1.2.13-beta.1