16 lines
383 B
Python
16 lines
383 B
Python
from __future__ import annotations
|
|
|
|
|
|
def to_ha_condition(icon: str, time_of_day: str | None) -> str:
|
|
if icon == "d":
|
|
return "sunny" if time_of_day == "day" else "clear-night"
|
|
mapping = {
|
|
"c": "cloudy",
|
|
"c_s": "snowy",
|
|
"c_r": "rainy",
|
|
"c_rs": "snowy-rainy",
|
|
"d_c": "partlycloudy",
|
|
}
|
|
return mapping.get(icon, "cloudy")
|
|
|
|
|