1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Implement Cloud coverage in Weather entity component (#95068)

This commit is contained in:
G Johansson
2023-06-22 23:10:36 +02:00
committed by GitHub
parent b8de7df609
commit eafddaae83
5 changed files with 36 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ Call init before using it in your tests to ensure clean test data.
from __future__ import annotations
from homeassistant.components.weather import (
ATTR_FORECAST_CLOUD_COVERAGE,
ATTR_FORECAST_NATIVE_APPARENT_TEMP,
ATTR_FORECAST_NATIVE_DEW_POINT,
ATTR_FORECAST_NATIVE_PRECIPITATION,
@@ -98,6 +99,11 @@ class MockWeather(MockEntity, WeatherEntity):
"""Return the ozone level."""
return self._handle("ozone")
@property
def cloud_coverage(self) -> float | None:
"""Return the cloud coverage in %."""
return self._handle("cloud_coverage")
@property
def native_visibility(self) -> float | None:
"""Return the visibility."""
@@ -210,6 +216,7 @@ class MockWeatherMockForecast(MockWeather):
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_CLOUD_COVERAGE: self.cloud_coverage,
ATTR_FORECAST_NATIVE_PRESSURE: self.native_pressure,
ATTR_FORECAST_NATIVE_WIND_SPEED: self.native_wind_speed,
ATTR_FORECAST_WIND_BEARING: self.wind_bearing,