mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Remove visibility from metoffice weather (#74314)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
08c2bd82bd
commit
98052646f2
@ -27,8 +27,6 @@ from .const import (
|
|||||||
MODE_3HOURLY_LABEL,
|
MODE_3HOURLY_LABEL,
|
||||||
MODE_DAILY,
|
MODE_DAILY,
|
||||||
MODE_DAILY_LABEL,
|
MODE_DAILY_LABEL,
|
||||||
VISIBILITY_CLASSES,
|
|
||||||
VISIBILITY_DISTANCE_CLASSES,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -104,19 +102,6 @@ class MetOfficeWeather(CoordinatorEntity, WeatherEntity):
|
|||||||
return self.coordinator.data.now.temperature.value
|
return self.coordinator.data.now.temperature.value
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
|
||||||
def visibility(self):
|
|
||||||
"""Return the platform visibility."""
|
|
||||||
_visibility = None
|
|
||||||
weather_now = self.coordinator.data.now
|
|
||||||
if hasattr(weather_now, "visibility"):
|
|
||||||
visibility_class = VISIBILITY_CLASSES.get(weather_now.visibility.value)
|
|
||||||
visibility_distance = VISIBILITY_DISTANCE_CLASSES.get(
|
|
||||||
weather_now.visibility.value
|
|
||||||
)
|
|
||||||
_visibility = f"{visibility_class} - {visibility_distance}"
|
|
||||||
return _visibility
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_pressure(self):
|
def native_pressure(self):
|
||||||
"""Return the mean sea-level pressure."""
|
"""Return the mean sea-level pressure."""
|
||||||
|
@ -136,7 +136,6 @@ async def test_one_weather_site_running(hass, requests_mock):
|
|||||||
assert weather.attributes.get("wind_speed") == 14.48
|
assert weather.attributes.get("wind_speed") == 14.48
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
||||||
assert weather.attributes.get("wind_bearing") == "SSE"
|
assert weather.attributes.get("wind_bearing") == "SSE"
|
||||||
assert weather.attributes.get("visibility") == "Good - 10-20"
|
|
||||||
assert weather.attributes.get("humidity") == 50
|
assert weather.attributes.get("humidity") == 50
|
||||||
|
|
||||||
# Forecasts added - just pick out 1 entry to check
|
# Forecasts added - just pick out 1 entry to check
|
||||||
@ -160,7 +159,6 @@ async def test_one_weather_site_running(hass, requests_mock):
|
|||||||
assert weather.attributes.get("temperature") == 19
|
assert weather.attributes.get("temperature") == 19
|
||||||
assert weather.attributes.get("wind_speed") == 14.48
|
assert weather.attributes.get("wind_speed") == 14.48
|
||||||
assert weather.attributes.get("wind_bearing") == "SSE"
|
assert weather.attributes.get("wind_bearing") == "SSE"
|
||||||
assert weather.attributes.get("visibility") == "Good - 10-20"
|
|
||||||
assert weather.attributes.get("humidity") == 50
|
assert weather.attributes.get("humidity") == 50
|
||||||
|
|
||||||
# Also has Forecasts added - again, just pick out 1 entry to check
|
# Also has Forecasts added - again, just pick out 1 entry to check
|
||||||
@ -233,7 +231,6 @@ async def test_two_weather_sites_running(hass, requests_mock):
|
|||||||
assert weather.attributes.get("wind_speed") == 14.48
|
assert weather.attributes.get("wind_speed") == 14.48
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
||||||
assert weather.attributes.get("wind_bearing") == "SSE"
|
assert weather.attributes.get("wind_bearing") == "SSE"
|
||||||
assert weather.attributes.get("visibility") == "Good - 10-20"
|
|
||||||
assert weather.attributes.get("humidity") == 50
|
assert weather.attributes.get("humidity") == 50
|
||||||
|
|
||||||
# Forecasts added - just pick out 1 entry to check
|
# Forecasts added - just pick out 1 entry to check
|
||||||
@ -258,7 +255,6 @@ async def test_two_weather_sites_running(hass, requests_mock):
|
|||||||
assert weather.attributes.get("wind_speed") == 14.48
|
assert weather.attributes.get("wind_speed") == 14.48
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
||||||
assert weather.attributes.get("wind_bearing") == "SSE"
|
assert weather.attributes.get("wind_bearing") == "SSE"
|
||||||
assert weather.attributes.get("visibility") == "Good - 10-20"
|
|
||||||
assert weather.attributes.get("humidity") == 50
|
assert weather.attributes.get("humidity") == 50
|
||||||
|
|
||||||
# Also has Forecasts added - again, just pick out 1 entry to check
|
# Also has Forecasts added - again, just pick out 1 entry to check
|
||||||
@ -283,7 +279,6 @@ async def test_two_weather_sites_running(hass, requests_mock):
|
|||||||
assert weather.attributes.get("wind_speed") == 3.22
|
assert weather.attributes.get("wind_speed") == 3.22
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
||||||
assert weather.attributes.get("wind_bearing") == "E"
|
assert weather.attributes.get("wind_bearing") == "E"
|
||||||
assert weather.attributes.get("visibility") == "Very Good - 20-40"
|
|
||||||
assert weather.attributes.get("humidity") == 60
|
assert weather.attributes.get("humidity") == 60
|
||||||
|
|
||||||
# Also has Forecast added - just pick out 1 entry to check
|
# Also has Forecast added - just pick out 1 entry to check
|
||||||
@ -308,7 +303,6 @@ async def test_two_weather_sites_running(hass, requests_mock):
|
|||||||
assert weather.attributes.get("wind_speed") == 6.44
|
assert weather.attributes.get("wind_speed") == 6.44
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
||||||
assert weather.attributes.get("wind_bearing") == "ESE"
|
assert weather.attributes.get("wind_bearing") == "ESE"
|
||||||
assert weather.attributes.get("visibility") == "Very Good - 20-40"
|
|
||||||
assert weather.attributes.get("humidity") == 75
|
assert weather.attributes.get("humidity") == 75
|
||||||
|
|
||||||
# All should have Forecast added - again, just picking out 1 entry to check
|
# All should have Forecast added - again, just picking out 1 entry to check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user