apetrycki / daikinskyport

API for accessing a DaikinOne+ Thermostat
59 stars 26 forks source link

Add all weather conditions #77

Open apetrycki opened 9 months ago

apetrycki commented 9 months ago

Need to complete mapping of weather conditions to icons via DAIKIN_WEATHER_SYMBOL_TO_HASS. I don't live somewhere cold, so others will have to help identify snowy conditions.

DAIKIN_WEATHER_SYMBOL_TO_HASS = { "Sunny": ATTR_CONDITION_SUNNY, "Mostly Sunny": ATTR_CONDITION_PARTLYCLOUDY, "Partly Cloudy": ATTR_CONDITION_PARTLYCLOUDY, "Clear": ATTR_CONDITION_CLEAR_NIGHT, "Fair": ATTR_CONDITION_CLEAR_NIGHT, "Cloudy": ATTR_CONDITION_CLOUDY, "Mostly Cloudy": ATTR_CONDITION_CLOUDY, "Rain": ATTR_CONDITION_RAINY, "Rain Shower": ATTR_CONDITION_RAINY, "Showers in the Vicinity": ATTR_CONDITION_RAINY, "Light Rain": ATTR_CONDITION_RAINY, "Snow": ATTR_CONDITION_SNOWY, #Unknown "Snow and Rain": ATTR_CONDITION_SNOWY_RAINY, #Unknown "Hail": ATTR_CONDITION_HAIL, #Unknown "Thunderstorms": ATTR_CONDITION_LIGHTNING_RAINY, "AM Thunderstorms": ATTR_CONDITION_LIGHTNING_RAINY, "Thunderstorms Late": ATTR_CONDITION_LIGHTNING_RAINY, "Fog": ATTR_CONDITION_FOG, #Unknown "Hazy": "hazy", #Unknown }

jf-navica commented 9 months ago

Willing to help as soon as winter kicks in. There's a related issue when using Daikin in another language, not sure how this could be fixed:

Key not found for weather condition: 'Ensoleillé'

apetrycki commented 9 months ago

Thanks, the help is appreciated.

That's a good question. I didn't realize the translations were done in the API and not the app. I probably need separate lists triggered by the selected language. Hopefully there is something in the API that indicates the language.

apetrycki commented 9 months ago

There is a "language" field that is a numerical value, so I'll need help enumerating that. 0 is obviously English. What does yours say? Is the language French?

It looks like there are also icon fields that I could and probably should use instead. Are those still English when in a different language?

jf-navica commented 9 months ago

"language":2 For French Icon names remain in english

apetrycki commented 9 months ago

Awesome, thanks! I'll switch to using the icon names. Right now I only have tstorms and partlycloudy. I assume rain, sunny, windy, etc. are also available. If you have any others verified, let me know.

HA translates the converted conditions automatically, so you should be able to just switch the language in HA and it'll work.

apetrycki commented 9 months ago

Updated list:

DAIKIN_WEATHER_ICON_TO_HASS = {
    "sunny": ATTR_CONDITION_SUNNY,
    "mostlysunny": ATTR_CONDITION_SUNNY,
    "partlysunny": ATTR_CONDITION_PARTLYCLOUDY, #Unverified
    "partlycloudy": ATTR_CONDITION_PARTLYCLOUDY,
    "clear": ATTR_CONDITION_CLEAR_NIGHT,
    "mostlycloudy": ATTR_CONDITION_CLOUDY,
    "cloudy": ATTR_CONDITION_CLOUDY, 
    "rain": ATTR_CONDITION_RAINY,
    "chancerain": ATTR_CONDITION_RAINY,
    "snow": ATTR_CONDITION_SNOWY, #Unverified
    "chancesnow": ATTR_CONDITION_SNOWY, #Unverified
    "chanceflurries": ATTR_CONDITION_SNOWY, #Unverified
    "flurries": ATTR_CONDITION_SNOWY, #Unverified
    "tstorms": ATTR_CONDITION_LIGHTNING,
    "chancetstorms": ATTR_CONDITION_LIGHTNING,
    "fog": ATTR_CONDITION_FOG, #Unverified
    "hazy": "hazy",
    "sleet": "sleet", #Unverified
    "chancesleet": "sleet",  #Unverified
}

Based on the names, I think they're using Weather Underground naming, so I added all the ones WU provides. I've confirmed a few. If anyone confirms others, please let me know. I live in Florida, so I'll never see snow, sleet, etc.