Implement dew point in weather entity component (#95072)

This commit is contained in:
G Johansson 2023-06-22 21:34:23 +02:00 committed by GitHub
parent fe71ed8c50
commit b8de7df609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 1 deletions

View file

@ -6,6 +6,7 @@ from __future__ import annotations
from homeassistant.components.weather import (
ATTR_FORECAST_NATIVE_APPARENT_TEMP,
ATTR_FORECAST_NATIVE_DEW_POINT,
ATTR_FORECAST_NATIVE_PRECIPITATION,
ATTR_FORECAST_NATIVE_PRESSURE,
ATTR_FORECAST_NATIVE_TEMP,
@ -52,6 +53,11 @@ class MockWeather(MockEntity, WeatherEntity):
"""Return the platform apparent temperature."""
return self._handle("native_apparent_temperature")
@property
def native_dew_point(self) -> float | None:
"""Return the platform dewpoint temperature."""
return self._handle("native_dew_point")
@property
def native_temperature_unit(self) -> str | None:
"""Return the unit of measurement for temperature."""
@ -203,6 +209,7 @@ class MockWeatherMockForecast(MockWeather):
ATTR_FORECAST_NATIVE_TEMP: self.native_temperature,
ATTR_FORECAST_NATIVE_APPARENT_TEMP: self.native_apparent_temperature,
ATTR_FORECAST_NATIVE_TEMP_LOW: self.native_temperature,
ATTR_FORECAST_NATIVE_DEW_POINT: self.native_dew_point,
ATTR_FORECAST_NATIVE_PRESSURE: self.native_pressure,
ATTR_FORECAST_NATIVE_WIND_SPEED: self.native_wind_speed,
ATTR_FORECAST_WIND_BEARING: self.wind_bearing,