feat: initial commit
This commit is contained in:
commit
e436fafd9e
13 changed files with 812 additions and 0 deletions
16
custom_components/two_gis_weather/icon_map.py
Normal file
16
custom_components/two_gis_weather/icon_map.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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")
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue