diff --git a/homeassistant/components/sensor/const.py b/homeassistant/components/sensor/const.py index aad882821d6..3dc8f878791 100644 --- a/homeassistant/components/sensor/const.py +++ b/homeassistant/components/sensor/const.py @@ -640,7 +640,11 @@ DEVICE_CLASS_STATE_CLASSES: dict[SensorDeviceClass, set[SensorStateClass]] = { SensorStateClass.TOTAL, SensorStateClass.TOTAL_INCREASING, }, - SensorDeviceClass.WEIGHT: {SensorStateClass.MEASUREMENT}, + SensorDeviceClass.WEIGHT: { + SensorStateClass.MEASUREMENT, + SensorStateClass.TOTAL, + SensorStateClass.TOTAL_INCREASING, + }, SensorDeviceClass.WIND_SPEED: {SensorStateClass.MEASUREMENT}, } diff --git a/tests/components/sensor/test_recorder.py b/tests/components/sensor/test_recorder.py index 2dcc873ca8b..b4b535473c1 100644 --- a/tests/components/sensor/test_recorder.py +++ b/tests/components/sensor/test_recorder.py @@ -988,6 +988,7 @@ async def test_compile_hourly_sum_statistics_amount( ("monetary", "SEK", "SEK", "SEK", None, 1), ("gas", "m³", "m³", "m³", "volume", 1), ("gas", "ft³", "ft³", "ft³", "volume", 1), + ("weight", "kg", "kg", "kg", "mass", 1), ], ) def test_compile_hourly_sum_statistics_amount_reset_every_state_change( @@ -1457,6 +1458,7 @@ def test_compile_hourly_sum_statistics_negative_state( ("monetary", "SEK", "SEK", "SEK", None, 1), ("gas", "m³", "m³", "m³", "volume", 1), ("gas", "ft³", "ft³", "ft³", "volume", 1), + ("weight", "kg", "kg", "kg", "mass", 1), ], ) def test_compile_hourly_sum_statistics_total_no_reset( @@ -1569,6 +1571,7 @@ def test_compile_hourly_sum_statistics_total_no_reset( ("energy", "Wh", "Wh", "Wh", "energy", 1), ("gas", "m³", "m³", "m³", "volume", 1), ("gas", "ft³", "ft³", "ft³", "volume", 1), + ("weight", "kg", "kg", "kg", "mass", 1), ], ) def test_compile_hourly_sum_statistics_total_increasing( @@ -1679,7 +1682,10 @@ def test_compile_hourly_sum_statistics_total_increasing( "unit_class", "factor", ), - [("energy", "kWh", "kWh", "kWh", "energy", 1)], + [ + ("energy", "kWh", "kWh", "kWh", "energy", 1), + ("weight", "kg", "kg", "kg", "mass", 1), + ], ) def test_compile_hourly_sum_statistics_total_increasing_small_dip( hass_recorder: Callable[..., HomeAssistant],