Skip to content

v1.2.13-beta.1

Pre-release
Pre-release

Choose a tag to compare

@alexdelprete alexdelprete released this 23 Feb 14:21
v1.2.13-beta.1
d524d50

Release v1.2.13-beta.1

GitHub Downloads

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_prodotta and energia_immessa registers 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_prodotta is new, energia_immessa is stale
    • Poll N+1: energia_immessa catches up, energia_prodotta is unchanged

    Calculating prodotta - immessa when only one has updated produces a temporary spike/dip.
    HA's TOTAL_INCREASING state 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 (MEASUREMENT state class) are always calculated
    immediately as before.

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:

  1. sensor.alfa_energy_self_consumed — Should increase monotonically, no sawtooth oscillation
  2. Utility meters tracking autoconsumption/consumption — Should show realistic values
  3. Debug logs — Enable debug logging for custom_components.sinapsi_alfa and look for
    "Skipping energy calc" messages confirming the sync logic is active during daytime
  4. 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_consumption
  • sensor.daily_energy_autoconsumption
  • sensor.monthly_energy_consumption
  • sensor.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_consumption

Tip: 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:

  1. Go to Developer Tools > Statistics
  2. Search for the affected sensor (e.g., sensor.alfa_energy_self_consumed)
  3. Click the adjust icon to correct individual hourly data points
  4. 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