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 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue