From 4600960895741a6fb99d4230d4bab11d9e2c660e Mon Sep 17 00:00:00 2001 From: Jeef Date: Fri, 7 Jun 2024 05:02:41 -0400 Subject: [PATCH] Align weatherflow_cloud weather conditions with Home Assistant supported conditions (#114497) * WeatherFlow Cloud changing icon mapping specificaly for Colorado * changing name to state_map --- .../components/weatherflow_cloud/const.py | 22 +++++++++++++++++++ .../components/weatherflow_cloud/weather.py | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/weatherflow_cloud/const.py b/homeassistant/components/weatherflow_cloud/const.py index 43594863e14..24ae2f3a3cb 100644 --- a/homeassistant/components/weatherflow_cloud/const.py +++ b/homeassistant/components/weatherflow_cloud/const.py @@ -7,3 +7,25 @@ LOGGER = logging.getLogger(__package__) ATTR_ATTRIBUTION = "Weather data delivered by WeatherFlow/Tempest REST Api" MANUFACTURER = "WeatherFlow" + +STATE_MAP = { + "clear-day": "sunny", + "clear-night": "clear-night", + "cloudy": "cloudy", + "foggy": "fog", + "partly-cloudy-day": "partlycloudy", + "partly-cloudy-night": "partlycloudy", + "possibly-rainy-day": "rainy", + "possibly-rainy-night": "rainy", + "possibly-sleet-day": "snowy-rainy", + "possibly-sleet-night": "snowy-rainy", + "possibly-snow-day": "snowy", + "possibly-snow-night": "snowy", + "possibly-thunderstorm-day": "lightning-rainy", + "possibly-thunderstorm-night": "lightning-rainy", + "rainy": "rainy", + "sleet": "snowy-rainy", + "snow": "snowy", + "thunderstorm": "lightning", + "windy": "windy", +} diff --git a/homeassistant/components/weatherflow_cloud/weather.py b/homeassistant/components/weatherflow_cloud/weather.py index 23aa6b1a031..47e2b6a28df 100644 --- a/homeassistant/components/weatherflow_cloud/weather.py +++ b/homeassistant/components/weatherflow_cloud/weather.py @@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .const import ATTR_ATTRIBUTION, DOMAIN, MANUFACTURER +from .const import ATTR_ATTRIBUTION, DOMAIN, MANUFACTURER, STATE_MAP from .coordinator import WeatherFlowCloudDataUpdateCoordinator @@ -86,7 +86,7 @@ class WeatherFlowWeather( @property def condition(self) -> str | None: """Return current condition - required property.""" - return self.local_data.weather.current_conditions.icon.ha_icon + return STATE_MAP[self.local_data.weather.current_conditions.icon.value] @property def native_temperature(self) -> float | None: