ha-2gis-weather/custom_components/two_gis_weather/icon_map.py
2025-11-04 11:21:01 +06:00

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")