From 238d57dbc21d286a15934a799ecd46e0306989de Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 21 Oct 2026 12:46:33 +0200 Subject: [PATCH] Use UnitOfRatio.PERCENTAGE in igloohome sensor (#187800) Co-authored-by: Claude --- homeassistant/components/igloohome/sensor.py | 3 ++- tests/components/igloohome/snapshots/test_sensor.ambr | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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',