Skip to content

Commit

Permalink
Fixed the excpetion and the missing low temperature in daily forecast
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunglung committed Mar 9, 2024
1 parent 13c00f2 commit 7f9dc53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions custom_components/opencwb/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions custom_components/opencwb/weather_update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ def _convert_forecast(self, entry):
"celsius").get("max")
forecast[ATTR_FORECAST_TEMP_LOW] = entry.temperature(
"celsius").get("min")
elif "temp_max" in temperature_dict and "temp_min" in temperature_dict:
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")
Expand Down

0 comments on commit 7f9dc53

Please sign in to comment.