diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a88171a..3c0b15f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ // Depending on setup, "remoteUser": "vscode", might be preferred to add. { "name": "met_next_6_hours_forecast", - "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.10", + "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11", "postCreateCommand": "scripts/setup", "forwardPorts": [ 8123 diff --git a/custom_components/met_next_6_hours_forecast/weather.py b/custom_components/met_next_6_hours_forecast/weather.py index 0ae44ea..b6b6bd9 100755 --- a/custom_components/met_next_6_hours_forecast/weather.py +++ b/custom_components/met_next_6_hours_forecast/weather.py @@ -24,6 +24,7 @@ from homeassistant.components.weather import ( Forecast, WeatherEntity, + WeatherEntityFeature, ) from .met_api import MetApi from .const import ATTR_FORECAST_JSON, ATTRIBUTION, DOMAIN, NAME, CONDITIONS_MAP @@ -58,6 +59,7 @@ class SixHoursWeather(WeatherEntity): _attr_native_temperature_unit = TEMP_CELSIUS _attr_native_wind_speed_unit = SPEED_METERS_PER_SECOND _attr_native_precipitation_unit = LENGTH_MILLIMETERS + _attr_supported_features = WeatherEntityFeature.FORECAST_HOURLY def __init__( self, @@ -166,6 +168,12 @@ def serialize_datetime(self, obj): return obj.isoformat() raise TypeError("Type not serializable") + async def async_forecast_hourly(self) -> list[Forecast] | None: + """Return the hourly forecast in native units. + Only implement this method if `WeatherEntityFeature.FORECAST_HOURLY` is set + """ + return self._forecast + async def async_update(self): """Retrieve latest state.""" self._raw_data = await self._hass.async_add_executor_job( diff --git a/requirements_dev.txt b/requirements_dev.txt index a581665..524fd26 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1 +1 @@ -homeassistant==2023.5.4 \ No newline at end of file +homeassistant==2023.11.3 \ No newline at end of file