mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-04-07 08:03:40 +00:00
fix(sensor): set state_class=None on static diagnostic metadata sensors
Four non-MONETARY diagnostic sensors had state_class set, causing HA Recorder to add them to long-term statistics tables unnecessarily: - home_size (m²): SensorStateClass.MEASUREMENT - main_fuse_size (A): SensorStateClass.MEASUREMENT - number_of_residents: SensorStateClass.MEASUREMENT - estimated_annual_consumption(kWh):SensorStateClass.TOTAL All four are static user metadata retrieved from Tibber's user API (cached for 24 h, rarely or never changes in practice). They carry no time-series value: home_size and main_fuse_size don't change, and estimated_annual_consumption is a rough Tibber estimate, not an actual accumulating energy counter. Setting state_class=None removes them from long-term statistics while keeping normal state-change recording intact. The three intentional non-None state_class values are unchanged: - current_interval_price (MONETARY, TOTAL): Energy Dashboard - current_interval_price_base (MONETARY, TOTAL): Energy Dashboard - average_price_today (MONETARY, TOTAL): useful weekly/monthly trend Impact: Reduced Recorder database growth; no user-visible sensor behaviour change.
This commit is contained in:
parent
422d1afbb7
commit
5411a75b79
1 changed files with 4 additions and 4 deletions
|
|
@ -796,7 +796,7 @@ DIAGNOSTIC_SENSORS = (
|
|||
icon="mdi:ruler-square",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
native_unit_of_measurement=UnitOfArea.SQUARE_METERS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
state_class=None, # Static user metadata: no statistics useful
|
||||
entity_registry_enabled_default=False,
|
||||
suggested_display_precision=0,
|
||||
),
|
||||
|
|
@ -807,7 +807,7 @@ DIAGNOSTIC_SENSORS = (
|
|||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
state_class=None, # Static user metadata: no statistics useful
|
||||
entity_registry_enabled_default=False,
|
||||
suggested_display_precision=0,
|
||||
),
|
||||
|
|
@ -816,7 +816,7 @@ DIAGNOSTIC_SENSORS = (
|
|||
translation_key="number_of_residents",
|
||||
icon="mdi:account-group",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
state_class=None, # Static user metadata: no statistics useful
|
||||
entity_registry_enabled_default=False,
|
||||
suggested_display_precision=0,
|
||||
),
|
||||
|
|
@ -902,7 +902,7 @@ DIAGNOSTIC_SENSORS = (
|
|||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL,
|
||||
state_class=None, # Static Tibber estimate, not an actual accumulating counter
|
||||
suggested_display_precision=0,
|
||||
),
|
||||
# Subscription data
|
||||
|
|
|
|||
Loading…
Reference in a new issue