mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 19:25:12 +02:00
Cache construction of battery icon (#102194)
This was being built every time state was written. When a robo vac is operating it writes state often which mean building the icon string over and over again when it rarely changes.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
"""Icon helper methods."""
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
|
||||
|
||||
@lru_cache
|
||||
def icon_for_battery_level(
|
||||
battery_level: int | None = None, charging: bool = False
|
||||
) -> str:
|
||||
|
Reference in New Issue
Block a user