diff --git a/homeassistant/components/esphome/sensor.py b/homeassistant/components/esphome/sensor.py index 045f74d3e4a..ceb391f6bda 100644 --- a/homeassistant/components/esphome/sensor.py +++ b/homeassistant/components/esphome/sensor.py @@ -13,6 +13,8 @@ import homeassistant.helpers.config_validation as cv from . import EsphomeEntity, esphome_state_property, platform_async_setup_entry +ICON_SCHEMA = vol.Schema(cv.icon) + async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities @@ -58,7 +60,7 @@ class EsphomeSensor(EsphomeEntity, SensorEntity): """Return the icon.""" if not self._static_info.icon or self._static_info.device_class: return None - return vol.Schema(cv.icon)(self._static_info.icon) + return ICON_SCHEMA(self._static_info.icon) @property def force_update(self) -> bool: