From c527defe3184b164acd014145566103463e00e95 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:28:59 +0200 Subject: [PATCH] Use SensorDeviceClass.WEIGHT in components (#79277) --- homeassistant/components/bthome/sensor.py | 4 ++-- homeassistant/components/litterrobot/sensor.py | 1 + homeassistant/components/mysensors/sensor.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/bthome/sensor.py b/homeassistant/components/bthome/sensor.py index d80763d4600..9d68ce2d3b4 100644 --- a/homeassistant/components/bthome/sensor.py +++ b/homeassistant/components/bthome/sensor.py @@ -145,14 +145,14 @@ SENSOR_DESCRIPTIONS = { # Used for mass sensor with kg unit (BTHomeSensorDeviceClass.MASS, Units.MASS_KILOGRAMS): SensorEntityDescription( key=f"{BTHomeSensorDeviceClass.MASS}_{Units.MASS_KILOGRAMS}", - device_class=None, + device_class=SensorDeviceClass.WEIGHT, native_unit_of_measurement=MASS_KILOGRAMS, state_class=SensorStateClass.MEASUREMENT, ), # Used for mass sensor with lb unit (BTHomeSensorDeviceClass.MASS, Units.MASS_POUNDS): SensorEntityDescription( key=f"{BTHomeSensorDeviceClass.MASS}_{Units.MASS_POUNDS}", - device_class=None, + device_class=SensorDeviceClass.WEIGHT, native_unit_of_measurement=MASS_POUNDS, state_class=SensorStateClass.MEASUREMENT, ), diff --git a/homeassistant/components/litterrobot/sensor.py b/homeassistant/components/litterrobot/sensor.py index 1a8f066f54b..b9d70528cab 100644 --- a/homeassistant/components/litterrobot/sensor.py +++ b/homeassistant/components/litterrobot/sensor.py @@ -111,6 +111,7 @@ ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = { name="Pet weight", icon="mdi:scale", native_unit_of_measurement=MASS_POUNDS, + device_class=SensorDeviceClass.WEIGHT, ), ], FeederRobot: [ diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index 6f940c5d625..dd10c203228 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -94,6 +94,7 @@ SENSORS: dict[str, SensorEntityDescription] = { "V_WEIGHT": SensorEntityDescription( key="V_WEIGHT", native_unit_of_measurement=MASS_KILOGRAMS, + device_class=SensorDeviceClass.WEIGHT, icon="mdi:weight-kilogram", ), "V_DISTANCE": SensorEntityDescription(