Skip to content

fix: restore state_class on monetary sensors#55

Open
tyrel wants to merge 1 commit into
jlvcm:mainfrom
tyrel:fix/restore-state-class
Open

fix: restore state_class on monetary sensors#55
tyrel wants to merge 1 commit into
jlvcm:mainfrom
tyrel:fix/restore-state-class

Conversation

@tyrel

@tyrel tyrel commented Apr 25, 2026

Copy link
Copy Markdown

Problem

The 3.0.0 DataUpdateCoordinator refactor accidentally dropped state_class from ActualBudgetAccountSensor and ActualBudgetBudgetSensor. Any user who had previously recorded long-term statistics for these entities now sees a HA repair warning: "The entity no longer has a state class".

Fix

Import SensorStateClass and add _attr_state_class = SensorStateClass.TOTAL to both monetary sensor classes. TOTAL is the value HA requires for SensorDeviceClass.MONETARY.

Testing

After reloading the integration, the repair warnings disappear and long-term statistics resume recording normally.

Fixes #53

The 3.0.0 DataUpdateCoordinator refactor accidentally dropped
state_class from ActualBudgetAccountSensor and ActualBudgetBudgetSensor,
causing HA to raise a "no longer has a state class" repair warning for
every budget entity that had previously recorded long-term statistics.

Adds _attr_state_class = SensorStateClass.TOTAL to both monetary sensor
classes, which is the value required by HA for SensorDeviceClass.MONETARY.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sensors "no longer have a state class" after upgrading to 3.0.0

1 participant