mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Only compile esphome icon schema once (#49688)
This commit is contained in:
parent
1b14a2f54f
commit
9a6402c1ae
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user