mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
add missing state class to dsmr sensors (#110712)
current_average_demand and maximum_demand_current_month are missing a state class, which gives errors in the statistics tab in HA. So adding them to the sensor.
This commit is contained in:
@@ -614,7 +614,7 @@ async def test_belgian_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
|
||||
avg_demand = hass.states.get("sensor.electricity_meter_current_average_demand")
|
||||
assert avg_demand.state == "1.75"
|
||||
assert avg_demand.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.KILO_WATT
|
||||
assert avg_demand.attributes.get(ATTR_STATE_CLASS) is None
|
||||
assert avg_demand.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
|
||||
# check max average demand is parsed correctly
|
||||
max_demand = hass.states.get(
|
||||
@@ -622,7 +622,7 @@ async def test_belgian_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
|
||||
)
|
||||
assert max_demand.state == "4.11"
|
||||
assert max_demand.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.KILO_WATT
|
||||
assert max_demand.attributes.get(ATTR_STATE_CLASS) is None
|
||||
assert max_demand.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
|
||||
# check if gas consumption mbus1 is parsed correctly
|
||||
gas_consumption = hass.states.get("sensor.gas_meter_gas_consumption")
|
||||
|
||||
Reference in New Issue
Block a user