mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00: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:
parent
d8e541a284
commit
e2e9c84c88
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user