diff --git a/homeassistant/components/igloohome/sensor.py b/homeassistant/components/igloohome/sensor.py index 994cd708a512..0585fed7f518 100644 --- a/homeassistant/components/igloohome/sensor.py +++ b/homeassistant/components/igloohome/sensor.py @@ -7,6 +7,7 @@ from aiohttp import ClientError from igloohome_api import Api as IgloohomeApi, ApiException, GetDeviceInfoResponse from homeassistant.components.sensor import SensorDeviceClass, SensorEntity +from homeassistant.const import UnitOfRatio from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -42,7 +43,7 @@ async def async_setup_entry( class IgloohomeBatteryEntity(IgloohomeBaseEntity, SensorEntity): """Implementation of a device that has a battery.""" - _attr_native_unit_of_measurement = "%" + _attr_native_unit_of_measurement = UnitOfRatio.PERCENTAGE _attr_device_class = SensorDeviceClass.BATTERY def __init__( diff --git a/tests/components/igloohome/snapshots/test_sensor.ambr b/tests/components/igloohome/snapshots/test_sensor.ambr index bd7f84ce3212..52e8e0ebeaba 100644 --- a/tests/components/igloohome/snapshots/test_sensor.ambr +++ b/tests/components/igloohome/snapshots/test_sensor.ambr @@ -33,7 +33,7 @@ 'supported_features': 0, 'translation_key': None, 'unique_id': 'battery_OE1X123cbb11', - 'unit_of_measurement': '%', + 'unit_of_measurement': , }) # --- # name: test_sensors[sensor.front_door_battery-state] @@ -41,7 +41,7 @@ 'attributes': ReadOnlyDict({ : 'battery', : 'Front Door Battery', - : '%', + : , }), 'context': , 'entity_id': 'sensor.front_door_battery',