diff --git a/custom_components/opencwb/weather.py b/custom_components/opencwb/weather.py index 11d5b8d..8cced69 100755 --- a/custom_components/opencwb/weather.py +++ b/custom_components/opencwb/weather.py @@ -58,6 +58,7 @@ def __init__( weather_coordinator: WeatherUpdateCoordinator, ): """Initialize the sensor.""" + super().__init__(weather_coordinator) self._attr_name = name self._attr_unique_id = unique_id self._weather_coordinator = weather_coordinator diff --git a/custom_components/opencwb/weather_update_coordinator.py b/custom_components/opencwb/weather_update_coordinator.py index d7ef776..f082b7b 100755 --- a/custom_components/opencwb/weather_update_coordinator.py +++ b/custom_components/opencwb/weather_update_coordinator.py @@ -203,11 +203,16 @@ def _convert_forecast(self, entry): } temperature_dict = entry.temperature("celsius") - if "max" in temperature_dict and "min" in temperature_dict: + if temperature_dict.get("max") and temperature_dict.get("min"): forecast[ATTR_FORECAST_TEMP] = entry.temperature( "celsius").get("max") forecast[ATTR_FORECAST_TEMP_LOW] = entry.temperature( "celsius").get("min") + elif temperature_dict.get("temp_max") and temperature_dict.get("temp_min"): + forecast[ATTR_FORECAST_TEMP] = entry.temperature( + "celsius").get("temp_max") + forecast[ATTR_FORECAST_TEMP_LOW] = entry.temperature( + "celsius").get("temp_min") else: forecast[ATTR_FORECAST_TEMP] = entry.temperature( "celsius").get("temp")