Expose dew point in Met.no (#98543)

This commit is contained in:
Sebastian Lövdahl 2023-08-17 08:45:23 +03:00 committed by GitHub
parent 52a8f01096
commit fde498586e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 4 deletions

View file

@ -22,6 +22,7 @@ from homeassistant.components.weather import (
ATTR_FORECAST_TIME,
ATTR_FORECAST_WIND_BEARING,
ATTR_WEATHER_CLOUD_COVERAGE,
ATTR_WEATHER_DEW_POINT,
ATTR_WEATHER_HUMIDITY,
ATTR_WEATHER_PRESSURE,
ATTR_WEATHER_TEMPERATURE,
@ -199,4 +200,5 @@ ATTR_MAP = {
ATTR_WEATHER_WIND_SPEED: "wind_speed",
ATTR_WEATHER_WIND_GUST_SPEED: "wind_gust",
ATTR_WEATHER_CLOUD_COVERAGE: "cloudiness",
ATTR_WEATHER_DEW_POINT: "dew_point",
}

View file

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/met",
"iot_class": "cloud_polling",
"loggers": ["metno"],
"requirements": ["PyMetno==0.10.0"]
"requirements": ["PyMetno==0.11.0"]
}

View file

@ -8,6 +8,7 @@ from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_TIME,
ATTR_WEATHER_CLOUD_COVERAGE,
ATTR_WEATHER_DEW_POINT,
ATTR_WEATHER_HUMIDITY,
ATTR_WEATHER_PRESSURE,
ATTR_WEATHER_TEMPERATURE,
@ -202,6 +203,13 @@ class MetWeather(CoordinatorEntity[MetDataUpdateCoordinator], WeatherEntity):
ATTR_MAP[ATTR_WEATHER_CLOUD_COVERAGE]
)
@property
def native_dew_point(self) -> float | None:
"""Return the dew point."""
return self.coordinator.data.current_weather_data.get(
ATTR_MAP[ATTR_WEATHER_DEW_POINT]
)
def _forecast(self, hourly: bool) -> list[Forecast] | None:
"""Return the forecast array."""
if hourly:

View file

@ -5,5 +5,5 @@
"documentation": "https://www.home-assistant.io/integrations/norway_air",
"iot_class": "cloud_polling",
"loggers": ["metno"],
"requirements": ["PyMetno==0.10.0"]
"requirements": ["PyMetno==0.11.0"]
}

View file

@ -73,7 +73,7 @@ PyMetEireann==2021.8.0
# homeassistant.components.met
# homeassistant.components.norway_air
PyMetno==0.10.0
PyMetno==0.11.0
# homeassistant.components.keymitt_ble
PyMicroBot==0.0.9

View file

@ -63,7 +63,7 @@ PyMetEireann==2021.8.0
# homeassistant.components.met
# homeassistant.components.norway_air
PyMetno==0.10.0
PyMetno==0.11.0
# homeassistant.components.keymitt_ble
PyMicroBot==0.0.9

View file

@ -17,6 +17,7 @@ def mock_weather():
"humidity": 50,
"wind_speed": 10,
"wind_bearing": "NE",
"dew_point": 12.1,
}
mock_data.get_forecast.return_value = {}
yield mock_data