Adjust icons with new device classes (#79348)

* Adjust icons with new device classes

* Fix mysensors tests

* Fix mysensors tests
This commit is contained in:
epenet 2022-09-30 10:41:18 +02:00 committed by GitHub
parent 52cdae254c
commit fb7079c62c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 5 deletions

View file

@ -130,6 +130,7 @@ SENSORS: Final[tuple[SensorEntityDescription, ...]] = (
key="total_liter_m3",
name="Total water usage",
native_unit_of_measurement=VOLUME_CUBIC_METERS,
icon="mdi:gauge",
device_class=SensorDeviceClass.VOLUME,
state_class=SensorStateClass.TOTAL_INCREASING,
),

View file

@ -109,7 +109,6 @@ ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = {
RobotSensorEntityDescription[LitterRobot4](
key="pet_weight",
name="Pet weight",
icon="mdi:scale",
native_unit_of_measurement=MASS_POUNDS,
device_class=SensorDeviceClass.WEIGHT,
),

View file

@ -95,13 +95,11 @@ SENSORS: dict[str, SensorEntityDescription] = {
key="V_WEIGHT",
native_unit_of_measurement=MASS_KILOGRAMS,
device_class=SensorDeviceClass.WEIGHT,
icon="mdi:weight-kilogram",
),
"V_DISTANCE": SensorEntityDescription(
key="V_DISTANCE",
native_unit_of_measurement=LENGTH_METERS,
device_class=SensorDeviceClass.DISTANCE,
icon="mdi:ruler",
),
"V_IMPEDANCE": SensorEntityDescription(
key="V_IMPEDANCE",

View file

@ -610,7 +610,7 @@ async def test_sensor_entity_total_liters(
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == VOLUME_CUBIC_METERS
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.VOLUME
assert state.attributes.get(ATTR_ICON) is None
assert state.attributes.get(ATTR_ICON) == "mdi:gauge"
async def test_sensor_entity_disabled_when_null(

View file

@ -117,7 +117,8 @@ async def test_distance_sensor(
assert state
assert state.state == "15"
assert state.attributes[ATTR_ICON] == "mdi:ruler"
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.DISTANCE
assert ATTR_ICON not in state.attributes
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == "cm"