Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pyopenweathermap to v0.2.1 #128892

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions homeassistant/components/openweathermap/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,13 @@
@staticmethod
def _get_precipitation_value(precipitation):
"""Get precipitation value from weather data."""
if "all" in precipitation:
return round(precipitation["all"], 2)
if "3h" in precipitation:
return round(precipitation["3h"], 2)
if "1h" in precipitation:
return round(precipitation["1h"], 2)
if precipitation is not None:
if "all" in precipitation:
return round(precipitation["all"], 2)

Check warning on line 197 in homeassistant/components/openweathermap/coordinator.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/openweathermap/coordinator.py#L197

Added line #L197 was not covered by tests
if "3h" in precipitation:
return round(precipitation["3h"], 2)

Check warning on line 199 in homeassistant/components/openweathermap/coordinator.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/openweathermap/coordinator.py#L199

Added line #L199 was not covered by tests
if "1h" in precipitation:
return round(precipitation["1h"], 2)

Check warning on line 201 in homeassistant/components/openweathermap/coordinator.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/openweathermap/coordinator.py#L201

Added line #L201 was not covered by tests
return 0

def _get_condition(self, weather_code, timestamp=None):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/openweathermap/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/openweathermap",
"iot_class": "cloud_polling",
"loggers": ["pyopenweathermap"],
"requirements": ["pyopenweathermap==0.1.1"]
"requirements": ["pyopenweathermap==0.2.1"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ pyombi==0.1.10
pyopenuv==2023.02.0

# homeassistant.components.openweathermap
pyopenweathermap==0.1.1
pyopenweathermap==0.2.1

# homeassistant.components.opnsense
pyopnsense==0.4.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ pyoctoprintapi==0.1.12
pyopenuv==2023.02.0

# homeassistant.components.openweathermap
pyopenweathermap==0.1.1
pyopenweathermap==0.2.1

# homeassistant.components.opnsense
pyopnsense==0.4.0
Expand Down
8 changes: 7 additions & 1 deletion tests/components/openweathermap/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
CurrentWeather,
DailyTemperature,
DailyWeatherForecast,
MinutelyWeatherForecast,
RequestError,
WeatherCondition,
WeatherReport,
Expand Down Expand Up @@ -105,7 +106,12 @@ def _create_mocked_owm_factory(is_valid: bool):
rain=0,
snow=0,
)
weather_report = WeatherReport(current_weather, [], [daily_weather_forecast])
minutely_weather_forecast = MinutelyWeatherForecast(
date_time=1728672360, precipitation=2.54
)
weather_report = WeatherReport(
current_weather, [minutely_weather_forecast], [], [daily_weather_forecast]
)

mocked_owm_client = MagicMock()
mocked_owm_client.validate_key = AsyncMock(return_value=is_valid)
Expand Down
Loading