From 6bc924c32705c3e7c271baf35446470f94983fc6 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:34:17 +0000 Subject: [PATCH 01/12] Update metoffice to use DataHub API --- .../components/geo_json_events/manifest.json | 2 +- .../components/metoffice/__init__.py | 71 +- .../components/metoffice/config_flow.py | 41 +- homeassistant/components/metoffice/const.py | 74 +- homeassistant/components/metoffice/data.py | 18 - homeassistant/components/metoffice/helpers.py | 55 +- .../components/metoffice/manifest.json | 2 +- homeassistant/components/metoffice/sensor.py | 131 +- .../components/metoffice/strings.json | 7 +- homeassistant/components/metoffice/weather.py | 198 +- requirements_all.txt | 4 +- requirements_test_all.txt | 4 +- tests/components/metoffice/conftest.py | 5 +- tests/components/metoffice/const.py | 36 +- .../metoffice/fixtures/metoffice.json | 5821 ++++++++++++----- .../metoffice/snapshots/test_weather.ambr | 3336 +++++++--- .../components/metoffice/test_config_flow.py | 26 +- tests/components/metoffice/test_init.py | 37 +- tests/components/metoffice/test_sensor.py | 94 +- tests/components/metoffice/test_weather.py | 157 +- 20 files changed, 7062 insertions(+), 3057 deletions(-) delete mode 100644 homeassistant/components/metoffice/data.py diff --git a/homeassistant/components/geo_json_events/manifest.json b/homeassistant/components/geo_json_events/manifest.json index 8f4b36657dd6b..c41796514a5e0 100644 --- a/homeassistant/components/geo_json_events/manifest.json +++ b/homeassistant/components/geo_json_events/manifest.json @@ -7,5 +7,5 @@ "integration_type": "service", "iot_class": "cloud_polling", "loggers": ["aio_geojson_generic_client"], - "requirements": ["aio-geojson-generic-client==0.4"] + "requirements": ["aio-geojson-generic-client==0.5"] } diff --git a/homeassistant/components/metoffice/__init__.py b/homeassistant/components/metoffice/__init__.py index 1d516bbc4f5a0..a0b85877a60e2 100644 --- a/homeassistant/components/metoffice/__init__.py +++ b/homeassistant/components/metoffice/__init__.py @@ -8,6 +8,8 @@ from typing import Any import datapoint +import datapoint.Forecast +import datapoint.Manager from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( @@ -18,7 +20,6 @@ Platform, ) from homeassistant.core import HomeAssistant, callback -from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import TimestampDataUpdateCoordinator @@ -30,11 +31,8 @@ METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, - MODE_3HOURLY, - MODE_DAILY, ) -from .data import MetOfficeData -from .helpers import fetch_data, fetch_site +from .helpers import fetch_data _LOGGER = logging.getLogger(__name__) @@ -60,82 +58,75 @@ def update_unique_id( if entity_entry.domain != Platform.SENSOR: return None - name_to_key = { - "Station Name": "name", - "Weather": "weather", - "Temperature": "temperature", - "Feels Like Temperature": "feels_like_temperature", - "Wind Speed": "wind_speed", - "Wind Direction": "wind_direction", - "Wind Gust": "wind_gust", - "Visibility": "visibility", - "Visibility Distance": "visibility_distance", - "UV Index": "uv", - "Probability of Precipitation": "precipitation", - "Humidity": "humidity", + key_mapping = { + "weather": "significantWeatherCode", + "temperature": "screenTemperature", + "feels_like_temperature": "feelsLikeTemperature", + "wind_speed": "windSpeed10m", + "wind_direction": "windDirectionFrom10m", + "wind_gust": "windGustSpeed10m", + "uv": "uvIndex", + "precipitation": "probOfPrecipitation", + "humidity": "screenRelativeHumidity", } - match = re.search(f"(?P.*)_{coordinates}.*", entity_entry.unique_id) + match = re.search(f"(?P.*)_{coordinates}.*", entity_entry.unique_id) if match is None: return None - if (name := match.group("name")) in name_to_key: + if (old_key := match.group("key")) in key_mapping: return { - "new_unique_id": entity_entry.unique_id.replace(name, name_to_key[name]) + "new_unique_id": entity_entry.unique_id.replace( + old_key, key_mapping[old_key] + ) } return None await er.async_migrate_entries(hass, entry.entry_id, update_unique_id) - connection = datapoint.connection(api_key=api_key) + connection = datapoint.Manager.Manager(api_key=api_key) - site = await hass.async_add_executor_job( - fetch_site, connection, latitude, longitude - ) - if site is None: - raise ConfigEntryNotReady - - async def async_update_3hourly() -> MetOfficeData: + async def async_update_daily() -> datapoint.Forecast: return await hass.async_add_executor_job( - fetch_data, connection, site, MODE_3HOURLY + fetch_data, connection, latitude, longitude, "daily" ) - async def async_update_daily() -> MetOfficeData: + async def async_update_hourly() -> datapoint.Forecast: return await hass.async_add_executor_job( - fetch_data, connection, site, MODE_DAILY + fetch_data, connection, latitude, longitude, "hourly" ) - metoffice_hourly_coordinator = TimestampDataUpdateCoordinator( + metoffice_daily_coordinator = TimestampDataUpdateCoordinator( hass, _LOGGER, config_entry=entry, - name=f"MetOffice Hourly Coordinator for {site_name}", - update_method=async_update_3hourly, + name=f"MetOffice Daily Coordinator for {site_name}", + update_method=async_update_daily, update_interval=DEFAULT_SCAN_INTERVAL, ) - metoffice_daily_coordinator = TimestampDataUpdateCoordinator( + metoffice_hourly_coordinator = TimestampDataUpdateCoordinator( hass, _LOGGER, config_entry=entry, - name=f"MetOffice Daily Coordinator for {site_name}", - update_method=async_update_daily, + name=f"MetOffice Hourly Coordinator for {site_name}", + update_method=async_update_hourly, update_interval=DEFAULT_SCAN_INTERVAL, ) metoffice_hass_data = hass.data.setdefault(DOMAIN, {}) metoffice_hass_data[entry.entry_id] = { - METOFFICE_HOURLY_COORDINATOR: metoffice_hourly_coordinator, METOFFICE_DAILY_COORDINATOR: metoffice_daily_coordinator, + METOFFICE_HOURLY_COORDINATOR: metoffice_hourly_coordinator, METOFFICE_NAME: site_name, METOFFICE_COORDINATES: coordinates, } # Fetch initial data so we have data when entities subscribe await asyncio.gather( - metoffice_hourly_coordinator.async_config_entry_first_refresh(), metoffice_daily_coordinator.async_config_entry_first_refresh(), + metoffice_hourly_coordinator.async_config_entry_first_refresh(), ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/homeassistant/components/metoffice/config_flow.py b/homeassistant/components/metoffice/config_flow.py index d46e537dadbf4..595f47de7b59d 100644 --- a/homeassistant/components/metoffice/config_flow.py +++ b/homeassistant/components/metoffice/config_flow.py @@ -2,10 +2,13 @@ from __future__ import annotations +from collections.abc import Mapping import logging from typing import Any import datapoint +from datapoint.exceptions import APIException +import datapoint.Manager import voluptuous as vol from homeassistant.config_entries import ConfigFlow, ConfigFlowResult @@ -15,7 +18,6 @@ from homeassistant.helpers import config_validation as cv from .const import DOMAIN -from .helpers import fetch_site _LOGGER = logging.getLogger(__name__) @@ -29,16 +31,16 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, longitude = data[CONF_LONGITUDE] api_key = data[CONF_API_KEY] - connection = datapoint.connection(api_key=api_key) + connection = datapoint.Manager.Manager(api_key=api_key) - site = await hass.async_add_executor_job( - fetch_site, connection, latitude, longitude + forecast = await hass.async_add_executor_job( + connection.get_forecast, latitude, longitude, "daily" ) - if site is None: + if forecast is None: raise CannotConnect - return {"site_name": site.name} + return {"site_name": forecast.name} class MetOfficeConfigFlow(ConfigFlow, domain=DOMAIN): @@ -59,7 +61,7 @@ async def async_step_user( try: info = await validate_input(self.hass, user_input) - except CannotConnect: + except (CannotConnect, APIException): errors["base"] = "cannot_connect" except Exception: _LOGGER.exception("Unexpected exception") @@ -86,6 +88,31 @@ async def async_step_user( step_id="user", data_schema=data_schema, errors=errors ) + async def async_step_reauth( + self, entry_data: Mapping[str, Any] + ) -> ConfigFlowResult: + """Perform reauth upon an API authentication error.""" + return await self.async_step_reauth_confirm() + + async def async_step_reauth_confirm( + self, user_input: dict[str, Any] | None = None + ) -> ConfigFlowResult: + """Dialog that informs the user that reauth is required.""" + if user_input is not None: + return self.async_update_reload_and_abort( + self._get_reauth_entry(), + data_updates=user_input, + ) + + return self.async_show_form( + step_id="reauth_confirm", + data_schema=vol.Schema( + { + vol.Required(CONF_API_KEY): str, + } + ), + ) + class CannotConnect(HomeAssistantError): """Error to indicate we cannot connect.""" diff --git a/homeassistant/components/metoffice/const.py b/homeassistant/components/metoffice/const.py index 966aec7d3811a..0699a4f307a32 100644 --- a/homeassistant/components/metoffice/const.py +++ b/homeassistant/components/metoffice/const.py @@ -33,46 +33,54 @@ METOFFICE_MONITORED_CONDITIONS = "metoffice_monitored_conditions" METOFFICE_NAME = "metoffice_name" -MODE_3HOURLY = "3hourly" -MODE_DAILY = "daily" - -CONDITION_CLASSES: dict[str, list[str]] = { - ATTR_CONDITION_CLEAR_NIGHT: ["0"], - ATTR_CONDITION_CLOUDY: ["7", "8"], - ATTR_CONDITION_FOG: ["5", "6"], - ATTR_CONDITION_HAIL: ["19", "20", "21"], - ATTR_CONDITION_LIGHTNING: ["30"], - ATTR_CONDITION_LIGHTNING_RAINY: ["28", "29"], - ATTR_CONDITION_PARTLYCLOUDY: ["2", "3"], - ATTR_CONDITION_POURING: ["13", "14", "15"], - ATTR_CONDITION_RAINY: ["9", "10", "11", "12"], - ATTR_CONDITION_SNOWY: ["22", "23", "24", "25", "26", "27"], - ATTR_CONDITION_SNOWY_RAINY: ["16", "17", "18"], - ATTR_CONDITION_SUNNY: ["1"], +# See mapping here: https://github.com/EJEP/datapoint-python/blob/master/src/datapoint/weather_codes.py +HOURLY_CONDITION_CLASSES: dict[str, list[str]] = { + ATTR_CONDITION_CLEAR_NIGHT: ["Clear night"], + ATTR_CONDITION_CLOUDY: ["Cloudy", "Overcast"], + ATTR_CONDITION_FOG: ["Mist", "Fog"], + ATTR_CONDITION_HAIL: ["Hail shower", "Hail"], + ATTR_CONDITION_LIGHTNING: ["Thunder"], + ATTR_CONDITION_LIGHTNING_RAINY: ["Thunder shower"], + ATTR_CONDITION_PARTLYCLOUDY: ["Partly cloudy"], + ATTR_CONDITION_POURING: ["Heavy rain shower", "Heavy rain"], + ATTR_CONDITION_RAINY: ["Light rain shower", "Drizzle", "Light rain"], + ATTR_CONDITION_SNOWY: [ + "Light snow shower", + "Light snow", + "Heavy snow shower", + "Heavy snow", + ], + ATTR_CONDITION_SNOWY_RAINY: ["Sleet shower", "Sleet"], + ATTR_CONDITION_SUNNY: ["Sunny day"], ATTR_CONDITION_WINDY: [], ATTR_CONDITION_WINDY_VARIANT: [], ATTR_CONDITION_EXCEPTIONAL: [], } -CONDITION_MAP = { +HOURLY_CONDITION_MAP = { cond_code: cond_ha - for cond_ha, cond_codes in CONDITION_CLASSES.items() + for cond_ha, cond_codes in HOURLY_CONDITION_CLASSES.items() for cond_code in cond_codes } -VISIBILITY_CLASSES = { - "VP": "Very Poor", - "PO": "Poor", - "MO": "Moderate", - "GO": "Good", - "VG": "Very Good", - "EX": "Excellent", +DAILY_CONDITION_CLASSES: dict[str, list[int]] = { + ATTR_CONDITION_CLEAR_NIGHT: [0], + ATTR_CONDITION_CLOUDY: [7, 8], + ATTR_CONDITION_FOG: [5, 6], + ATTR_CONDITION_HAIL: [19, 20, 21], + ATTR_CONDITION_LIGHTNING: [30], + ATTR_CONDITION_LIGHTNING_RAINY: [28, 29], + ATTR_CONDITION_PARTLYCLOUDY: [2, 3], + ATTR_CONDITION_POURING: [13, 14, 15], + ATTR_CONDITION_RAINY: [9, 10, 11, 12], + ATTR_CONDITION_SNOWY: [22, 23, 24, 25, 26, 27], + ATTR_CONDITION_SNOWY_RAINY: [16, 17, 18], + ATTR_CONDITION_SUNNY: [1], + ATTR_CONDITION_WINDY: [], + ATTR_CONDITION_WINDY_VARIANT: [], + ATTR_CONDITION_EXCEPTIONAL: [], } - -VISIBILITY_DISTANCE_CLASSES = { - "VP": "<1", - "PO": "1-4", - "MO": "4-10", - "GO": "10-20", - "VG": "20-40", - "EX": ">40", +DAILY_CONDITION_MAP = { + cond_code: cond_ha + for cond_ha, cond_codes in DAILY_CONDITION_CLASSES.items() + for cond_code in cond_codes } diff --git a/homeassistant/components/metoffice/data.py b/homeassistant/components/metoffice/data.py deleted file mode 100644 index 651e56c3adc56..0000000000000 --- a/homeassistant/components/metoffice/data.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Common Met Office Data class used by both sensor and entity.""" - -from __future__ import annotations - -from dataclasses import dataclass - -from datapoint.Forecast import Forecast -from datapoint.Site import Site -from datapoint.Timestep import Timestep - - -@dataclass -class MetOfficeData: - """Data structure for MetOffice weather and forecast.""" - - now: Forecast - forecast: list[Timestep] - site: Site diff --git a/homeassistant/components/metoffice/helpers.py b/homeassistant/components/metoffice/helpers.py index 56d4d8f971b3e..6ffe350d40e5e 100644 --- a/homeassistant/components/metoffice/helpers.py +++ b/homeassistant/components/metoffice/helpers.py @@ -3,51 +3,38 @@ from __future__ import annotations import logging +from typing import Any, Literal import datapoint -from datapoint.Site import Site +from datapoint.Forecast import Forecast +from requests import HTTPError +from homeassistant.exceptions import ConfigEntryAuthFailed from homeassistant.helpers.update_coordinator import UpdateFailed -from homeassistant.util.dt import utcnow - -from .const import MODE_3HOURLY -from .data import MetOfficeData _LOGGER = logging.getLogger(__name__) -def fetch_site( - connection: datapoint.Manager, latitude: float, longitude: float -) -> Site | None: - """Fetch site information from Datapoint API.""" - try: - return connection.get_nearest_forecast_site( - latitude=latitude, longitude=longitude - ) - except datapoint.exceptions.APIException as err: - _LOGGER.error("Received error from Met Office Datapoint: %s", err) - return None - - -def fetch_data(connection: datapoint.Manager, site: Site, mode: str) -> MetOfficeData: +def fetch_data( + connection: datapoint.Manager, + latitude: float, + longitude: float, + frequency: Literal["daily", "hourly"], +) -> Forecast: """Fetch weather and forecast from Datapoint API.""" try: - forecast = connection.get_forecast_for_site(site.location_id, mode) + return connection.get_forecast(latitude, longitude, frequency) except (ValueError, datapoint.exceptions.APIException) as err: _LOGGER.error("Check Met Office connection: %s", err.args) raise UpdateFailed from err + except HTTPError as err: + if err.response.status_code == 401: + raise ConfigEntryAuthFailed from err + raise + - time_now = utcnow() - return MetOfficeData( - now=forecast.now(), - forecast=[ - timestep - for day in forecast.days - for timestep in day.timesteps - if timestep.date > time_now - and ( - mode == MODE_3HOURLY or timestep.date.hour > 6 - ) # ensures only one result per day in MODE_DAILY - ], - site=site, - ) +def get_attribute(data: dict[str, Any] | None, attr_name: str) -> Any | None: + """Get an attribute from weather data.""" + if data: + return data.get(attr_name, {}).get("value") + return None diff --git a/homeassistant/components/metoffice/manifest.json b/homeassistant/components/metoffice/manifest.json index 17643d7e06151..c60d3a789b867 100644 --- a/homeassistant/components/metoffice/manifest.json +++ b/homeassistant/components/metoffice/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/metoffice", "iot_class": "cloud_polling", "loggers": ["datapoint"], - "requirements": ["datapoint==0.9.9"] + "requirements": ["datapoint==0.10.0"] } diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index 61f825abdc35b..fda6dc4c0b76f 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -4,9 +4,10 @@ from typing import Any -from datapoint.Element import Element +from datapoint.Forecast import Forecast from homeassistant.components.sensor import ( + DOMAIN as SENSOR_DOMAIN, SensorDeviceClass, SensorEntity, SensorEntityDescription, @@ -16,10 +17,12 @@ PERCENTAGE, UV_INDEX, UnitOfLength, + UnitOfPressure, UnitOfSpeed, UnitOfTemperature, ) from homeassistant.core import HomeAssistant +from homeassistant.helpers import entity_registry as er from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import StateType from homeassistant.helpers.update_coordinator import ( @@ -30,21 +33,16 @@ from . import get_device_info from .const import ( ATTRIBUTION, - CONDITION_MAP, DOMAIN, + HOURLY_CONDITION_MAP, METOFFICE_COORDINATES, - METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, - MODE_DAILY, - VISIBILITY_CLASSES, - VISIBILITY_DISTANCE_CLASSES, ) -from .data import MetOfficeData +from .helpers import get_attribute ATTR_LAST_UPDATE = "last_update" ATTR_SENSOR_ID = "sensor_id" -ATTR_SITE_ID = "site_id" ATTR_SITE_NAME = "site_name" @@ -56,13 +54,13 @@ entity_registry_enabled_default=False, ), SensorEntityDescription( - key="weather", + key="significantWeatherCode", name="Weather", icon="mdi:weather-sunny", # but will adapt to current conditions entity_registry_enabled_default=True, ), SensorEntityDescription( - key="temperature", + key="screenTemperature", name="Temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -70,7 +68,7 @@ entity_registry_enabled_default=True, ), SensorEntityDescription( - key="feels_like_temperature", + key="feelsLikeTemperature", name="Feels like temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -78,9 +76,17 @@ entity_registry_enabled_default=False, ), SensorEntityDescription( - key="wind_speed", + key="mslp", + name="Pressure", + device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE, + native_unit_of_measurement=UnitOfPressure.PA, + icon=None, + entity_registry_enabled_default=True, + ), + SensorEntityDescription( + key="windSpeed10m", name="Wind speed", - native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, + native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, # Hint mph because that's the preferred unit for wind speeds in UK # This can be removed if we add a mixed metric/imperial unit system for UK users suggested_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, @@ -88,15 +94,15 @@ entity_registry_enabled_default=True, ), SensorEntityDescription( - key="wind_direction", + key="windDirectionFrom10m", name="Wind direction", icon="mdi:compass-outline", entity_registry_enabled_default=False, ), SensorEntityDescription( - key="wind_gust", + key="windGustSpeed10m", name="Wind gust", - native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, + native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, # Hint mph because that's the preferred unit for wind speeds in UK # This can be removed if we add a mixed metric/imperial unit system for UK users suggested_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, @@ -105,33 +111,27 @@ ), SensorEntityDescription( key="visibility", - name="Visibility", - icon="mdi:eye", - entity_registry_enabled_default=False, - ), - SensorEntityDescription( - key="visibility_distance", name="Visibility distance", - native_unit_of_measurement=UnitOfLength.KILOMETERS, + native_unit_of_measurement=UnitOfLength.METERS, icon="mdi:eye", entity_registry_enabled_default=False, ), SensorEntityDescription( - key="uv", + key="uvIndex", name="UV index", native_unit_of_measurement=UV_INDEX, icon="mdi:weather-sunny-alert", entity_registry_enabled_default=True, ), SensorEntityDescription( - key="precipitation", + key="probOfPrecipitation", name="Probability of precipitation", native_unit_of_measurement=PERCENTAGE, icon="mdi:weather-rainy", entity_registry_enabled_default=True, ), SensorEntityDescription( - key="humidity", + key="screenRelativeHumidity", name="Humidity", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, @@ -145,23 +145,37 @@ async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Set up the Met Office weather sensor platform.""" + entity_registry = er.async_get(hass) hass_data = hass.data[DOMAIN][entry.entry_id] + # Remove daily entities from legacy config entries + for description in SENSOR_TYPES: + if entity_id := entity_registry.async_get_entity_id( + SENSOR_DOMAIN, + DOMAIN, + f"{description.key}_{hass_data[METOFFICE_COORDINATES]}_daily", + ): + entity_registry.async_remove(entity_id) + + # Remove old visibility sensors + if entity_id := entity_registry.async_get_entity_id( + SENSOR_DOMAIN, + DOMAIN, + f"visibility_distance_{hass_data[METOFFICE_COORDINATES]}_daily", + ): + entity_registry.async_remove(entity_id) + if entity_id := entity_registry.async_get_entity_id( + SENSOR_DOMAIN, + DOMAIN, + f"visibility_distance_{hass_data[METOFFICE_COORDINATES]}", + ): + entity_registry.async_remove(entity_id) + async_add_entities( [ MetOfficeCurrentSensor( hass_data[METOFFICE_HOURLY_COORDINATOR], hass_data, - True, - description, - ) - for description in SENSOR_TYPES - ] - + [ - MetOfficeCurrentSensor( - hass_data[METOFFICE_DAILY_COORDINATOR], - hass_data, - False, description, ) for description in SENSOR_TYPES @@ -171,7 +185,7 @@ async def async_setup_entry( class MetOfficeCurrentSensor( - CoordinatorEntity[DataUpdateCoordinator[MetOfficeData]], SensorEntity + CoordinatorEntity[DataUpdateCoordinator[Forecast]], SensorEntity ): """Implementation of a Met Office current weather condition sensor.""" @@ -180,55 +194,31 @@ class MetOfficeCurrentSensor( def __init__( self, - coordinator: DataUpdateCoordinator[MetOfficeData], + coordinator: DataUpdateCoordinator[Forecast], hass_data: dict[str, Any], - use_3hourly: bool, description: SensorEntityDescription, ) -> None: """Initialize the sensor.""" super().__init__(coordinator) self.entity_description = description - mode_label = "3-hourly" if use_3hourly else "daily" self._attr_device_info = get_device_info( coordinates=hass_data[METOFFICE_COORDINATES], name=hass_data[METOFFICE_NAME] ) - self._attr_name = f"{description.name} {mode_label}" + self._attr_name = f"{description.name}" self._attr_unique_id = f"{description.key}_{hass_data[METOFFICE_COORDINATES]}" - if not use_3hourly: - self._attr_unique_id = f"{self._attr_unique_id}_{MODE_DAILY}" self._attr_entity_registry_enabled_default = ( - self.entity_description.entity_registry_enabled_default and use_3hourly + self.entity_description.entity_registry_enabled_default ) @property def native_value(self) -> StateType: """Return the state of the sensor.""" - value = None - - if self.entity_description.key == "visibility_distance" and hasattr( - self.coordinator.data.now, "visibility" - ): - value = VISIBILITY_DISTANCE_CLASSES.get( - self.coordinator.data.now.visibility.value - ) - - if self.entity_description.key == "visibility" and hasattr( - self.coordinator.data.now, "visibility" - ): - value = VISIBILITY_CLASSES.get(self.coordinator.data.now.visibility.value) - - elif self.entity_description.key == "weather" and hasattr( - self.coordinator.data.now, self.entity_description.key - ): - value = CONDITION_MAP.get(self.coordinator.data.now.weather.value) - - elif hasattr(self.coordinator.data.now, self.entity_description.key): - value = getattr(self.coordinator.data.now, self.entity_description.key) + value = get_attribute(self.coordinator.data.now(), self.entity_description.key) - if isinstance(value, Element): - value = value.value + if self.entity_description.key == "significantWeatherCode" and value: + value = HOURLY_CONDITION_MAP.get(value) return value @@ -236,7 +226,7 @@ def native_value(self) -> StateType: def icon(self) -> str | None: """Return the icon for the entity card.""" value = self.entity_description.icon - if self.entity_description.key == "weather": + if self.entity_description.key == "significantWeatherCode": value = self.state if value is None: value = "sunny" @@ -250,8 +240,7 @@ def icon(self) -> str | None: def extra_state_attributes(self) -> dict[str, Any]: """Return the state attributes of the device.""" return { - ATTR_LAST_UPDATE: self.coordinator.data.now.date, + ATTR_LAST_UPDATE: self.coordinator.data.now()["time"], ATTR_SENSOR_ID: self.entity_description.key, - ATTR_SITE_ID: self.coordinator.data.site.location_id, - ATTR_SITE_NAME: self.coordinator.data.site.name, + ATTR_SITE_NAME: self.coordinator.data.name, } diff --git a/homeassistant/components/metoffice/strings.json b/homeassistant/components/metoffice/strings.json index 5a1c59bcfb72f..32f31618a0415 100644 --- a/homeassistant/components/metoffice/strings.json +++ b/homeassistant/components/metoffice/strings.json @@ -2,13 +2,18 @@ "config": { "step": { "user": { - "description": "The latitude and longitude will be used to find the closest weather station.", "title": "Connect to the UK Met Office", "data": { "api_key": "[%key:common::config_flow::data::api_key%]", "latitude": "[%key:common::config_flow::data::latitude%]", "longitude": "[%key:common::config_flow::data::longitude%]" } + }, + "reauth_confirm": { + "title": "Reauthenticate with DataHub API", + "data": { + "api_key": "[%key:common::config_flow::data::api_key%]" + } } }, "error": { diff --git a/homeassistant/components/metoffice/weather.py b/homeassistant/components/metoffice/weather.py index 5eeddee8dd45d..4d3a95e31ce5a 100644 --- a/homeassistant/components/metoffice/weather.py +++ b/homeassistant/components/metoffice/weather.py @@ -2,15 +2,23 @@ from __future__ import annotations +from datetime import datetime from typing import Any, cast -from datapoint.Timestep import Timestep +from datapoint.Forecast import Forecast as ForecastData from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, + ATTR_FORECAST_IS_DAYTIME, + ATTR_FORECAST_NATIVE_APPARENT_TEMP, + ATTR_FORECAST_NATIVE_PRESSURE, ATTR_FORECAST_NATIVE_TEMP, + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED, ATTR_FORECAST_NATIVE_WIND_SPEED, + ATTR_FORECAST_PRECIPITATION, ATTR_FORECAST_PRECIPITATION_PROBABILITY, + ATTR_FORECAST_TEMP_LOW, + ATTR_FORECAST_UV_INDEX, ATTR_FORECAST_WIND_BEARING, DOMAIN as WEATHER_DOMAIN, CoordinatorWeatherEntity, @@ -18,7 +26,12 @@ WeatherEntityFeature, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import UnitOfPressure, UnitOfSpeed, UnitOfTemperature +from homeassistant.const import ( + UnitOfLength, + UnitOfPressure, + UnitOfSpeed, + UnitOfTemperature, +) from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import entity_registry as er from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -27,15 +40,15 @@ from . import get_device_info from .const import ( ATTRIBUTION, - CONDITION_MAP, + DAILY_CONDITION_MAP, DOMAIN, + HOURLY_CONDITION_MAP, METOFFICE_COORDINATES, METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, - MODE_DAILY, ) -from .data import MetOfficeData +from .helpers import get_attribute async def async_setup_entry( @@ -45,11 +58,11 @@ async def async_setup_entry( entity_registry = er.async_get(hass) hass_data = hass.data[DOMAIN][entry.entry_id] - # Remove hourly entity from legacy config entries + # Remove daily entity from legacy config entries if entity_id := entity_registry.async_get_entity_id( WEATHER_DOMAIN, DOMAIN, - _calculate_unique_id(hass_data[METOFFICE_COORDINATES], True), + f"{hass_data[METOFFICE_COORDINATES]}_daily", ): entity_registry.async_remove(entity_id) @@ -65,54 +78,83 @@ async def async_setup_entry( ) -def _build_forecast_data(timestep: Timestep) -> Forecast: - data = Forecast(datetime=timestep.date.isoformat()) - if timestep.weather: - data[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(timestep.weather.value) - if timestep.precipitation: - data[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = timestep.precipitation.value - if timestep.temperature: - data[ATTR_FORECAST_NATIVE_TEMP] = timestep.temperature.value - if timestep.wind_direction: - data[ATTR_FORECAST_WIND_BEARING] = timestep.wind_direction.value - if timestep.wind_speed: - data[ATTR_FORECAST_NATIVE_WIND_SPEED] = timestep.wind_speed.value +def _build_hourly_forecast_data(timestep: dict[str, Any]) -> Forecast: + data = Forecast(datetime=timestep["time"].isoformat()) + weather_code = get_attribute(timestep, "significantWeatherCode") + if weather_code: + data[ATTR_FORECAST_CONDITION] = HOURLY_CONDITION_MAP.get(weather_code) + + data[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_attribute( + timestep, "feelsLikeTemperature" + ) + data[ATTR_FORECAST_NATIVE_PRESSURE] = get_attribute(timestep, "mslp") + data[ATTR_FORECAST_NATIVE_TEMP] = get_attribute(timestep, "screenTemperature") + data[ATTR_FORECAST_PRECIPITATION] = get_attribute(timestep, "totalPrecipAmount") + data[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = get_attribute( + timestep, "probOfPrecipitation" + ) + data[ATTR_FORECAST_UV_INDEX] = get_attribute(timestep, "uvIndex") + data[ATTR_FORECAST_WIND_BEARING] = get_attribute(timestep, "windDirectionFrom10m") + data[ATTR_FORECAST_NATIVE_WIND_SPEED] = get_attribute(timestep, "windSpeed10m") + data[ATTR_FORECAST_NATIVE_WIND_GUST_SPEED] = get_attribute( + timestep, "windGustSpeed10m" + ) + return data -def _calculate_unique_id(coordinates: str, use_3hourly: bool) -> str: - """Calculate unique ID.""" - if use_3hourly: - return coordinates - return f"{coordinates}_{MODE_DAILY}" +def _build_twice_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: + data = Forecast(datetime=timestep["time"].isoformat()) + data[ATTR_FORECAST_IS_DAYTIME] = abs(timestep["time"].hour - 12) <= 1 + weather_code = get_attribute(timestep, "SignificantWeatherCode") + if weather_code: + data[ATTR_FORECAST_CONDITION] = DAILY_CONDITION_MAP.get(weather_code) + + data[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_attribute( + timestep, "MaxFeelsLikeTemp" + ) + data[ATTR_FORECAST_NATIVE_PRESSURE] = get_attribute(timestep, "Mslp") + data[ATTR_FORECAST_NATIVE_TEMP] = get_attribute(timestep, "UpperBoundMaxTemp") + data[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = get_attribute( + timestep, "ProbabilityOfPrecipitation" + ) + data[ATTR_FORECAST_TEMP_LOW] = get_attribute(timestep, "LowerBoundMaxTemp") + data[ATTR_FORECAST_UV_INDEX] = get_attribute(timestep, "maxUvIndex") + data[ATTR_FORECAST_WIND_BEARING] = get_attribute(timestep, "10MWindDirection") + data[ATTR_FORECAST_NATIVE_WIND_SPEED] = get_attribute(timestep, "10MWindSpeed") + data[ATTR_FORECAST_NATIVE_WIND_GUST_SPEED] = get_attribute(timestep, "10MWindGust") + return data class MetOfficeWeather( CoordinatorWeatherEntity[ - TimestampDataUpdateCoordinator[MetOfficeData], - TimestampDataUpdateCoordinator[MetOfficeData], + TimestampDataUpdateCoordinator[ForecastData], + TimestampDataUpdateCoordinator[ForecastData], ] ): """Implementation of a Met Office weather condition.""" _attr_attribution = ATTRIBUTION _attr_has_entity_name = True + _attr_name = None _attr_native_temperature_unit = UnitOfTemperature.CELSIUS - _attr_native_pressure_unit = UnitOfPressure.HPA - _attr_native_wind_speed_unit = UnitOfSpeed.MILES_PER_HOUR + _attr_native_pressure_unit = UnitOfPressure.PA + _attr_native_precipitation_unit = UnitOfLength.MILLIMETERS + _attr_native_visibility_unit = UnitOfLength.METERS + _attr_native_wind_speed_unit = UnitOfSpeed.METERS_PER_SECOND _attr_supported_features = ( - WeatherEntityFeature.FORECAST_HOURLY | WeatherEntityFeature.FORECAST_DAILY + WeatherEntityFeature.FORECAST_HOURLY | WeatherEntityFeature.FORECAST_TWICE_DAILY ) def __init__( self, - coordinator_daily: TimestampDataUpdateCoordinator[MetOfficeData], - coordinator_hourly: TimestampDataUpdateCoordinator[MetOfficeData], + coordinator_daily: TimestampDataUpdateCoordinator[ForecastData], + coordinator_hourly: TimestampDataUpdateCoordinator[ForecastData], hass_data: dict[str, Any], ) -> None: """Initialise the platform with a data instance.""" - observation_coordinator = coordinator_daily + observation_coordinator = coordinator_hourly super().__init__( observation_coordinator, daily_coordinator=coordinator_daily, @@ -122,81 +164,99 @@ def __init__( self._attr_device_info = get_device_info( coordinates=hass_data[METOFFICE_COORDINATES], name=hass_data[METOFFICE_NAME] ) - self._attr_name = "Daily" - self._attr_unique_id = _calculate_unique_id( - hass_data[METOFFICE_COORDINATES], False - ) + self._attr_unique_id = hass_data[METOFFICE_COORDINATES] @property def condition(self) -> str | None: """Return the current condition.""" - if self.coordinator.data.now: - return CONDITION_MAP.get(self.coordinator.data.now.weather.value) + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "significantWeatherCode") + + if value: + return HOURLY_CONDITION_MAP.get(value) return None @property def native_temperature(self) -> float | None: """Return the platform temperature.""" - weather_now = self.coordinator.data.now - if weather_now.temperature: - value = weather_now.temperature.value - return float(value) if value is not None else None - return None + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "screenTemperature") + return float(value) if value is not None else None + + @property + def native_dew_point(self) -> float | None: + """Return the dew point.""" + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "screenDewPointTemperature") + return float(value) if value is not None else None @property def native_pressure(self) -> float | None: """Return the mean sea-level pressure.""" - weather_now = self.coordinator.data.now - if weather_now and weather_now.pressure: - value = weather_now.pressure.value - return float(value) if value is not None else None - return None + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "mslp") + return float(value) if value is not None else None @property def humidity(self) -> float | None: """Return the relative humidity.""" - weather_now = self.coordinator.data.now - if weather_now and weather_now.humidity: - value = weather_now.humidity.value - return float(value) if value is not None else None - return None + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "screenRelativeHumidity") + return float(value) if value is not None else None + + @property + def uv_index(self) -> float | None: + """Return the UV index.""" + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "uvIndex") + return float(value) if value is not None else None + + @property + def native_visibility(self) -> float | None: + """Return the visibility.""" + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "visibility") + return float(value) if value is not None else None @property def native_wind_speed(self) -> float | None: """Return the wind speed.""" - weather_now = self.coordinator.data.now - if weather_now and weather_now.wind_speed: - value = weather_now.wind_speed.value - return float(value) if value is not None else None - return None + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "windSpeed10m") + return float(value) if value is not None else None @property - def wind_bearing(self) -> str | None: + def wind_bearing(self) -> float | None: """Return the wind bearing.""" - weather_now = self.coordinator.data.now - if weather_now and weather_now.wind_direction: - value = weather_now.wind_direction.value - return str(value) if value is not None else None - return None + weather_now = self.coordinator.data.now() + value = get_attribute(weather_now, "windDirectionFrom10m") + return float(value) if value is not None else None @callback - def _async_forecast_daily(self) -> list[Forecast] | None: + def _async_forecast_twice_daily(self) -> list[Forecast] | None: """Return the twice daily forecast in native units.""" coordinator = cast( - TimestampDataUpdateCoordinator[MetOfficeData], + TimestampDataUpdateCoordinator[ForecastData], self.forecast_coordinators["daily"], ) + timesteps = coordinator.data.timesteps return [ - _build_forecast_data(timestep) for timestep in coordinator.data.forecast + _build_twice_daily_forecast_data(timestep) + for timestep in timesteps + if timestep["time"] > datetime.now(tz=timesteps[0]["time"].tzinfo) ] @callback def _async_forecast_hourly(self) -> list[Forecast] | None: """Return the hourly forecast in native units.""" coordinator = cast( - TimestampDataUpdateCoordinator[MetOfficeData], + TimestampDataUpdateCoordinator[ForecastData], self.forecast_coordinators["hourly"], ) + + timesteps = coordinator.data.timesteps return [ - _build_forecast_data(timestep) for timestep in coordinator.data.forecast + _build_hourly_forecast_data(timestep) + for timestep in timesteps + if timestep["time"] > datetime.now(tz=timesteps[0]["time"].tzinfo) ] diff --git a/requirements_all.txt b/requirements_all.txt index fe6cdaa78bb32..dcac9c0b09187 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -155,7 +155,7 @@ afsapi==0.2.7 agent-py==0.0.24 # homeassistant.components.geo_json_events -aio-geojson-generic-client==0.4 +aio-geojson-generic-client==0.5 # homeassistant.components.geonetnz_quakes aio-geojson-geonetnz-quakes==0.16 @@ -723,7 +723,7 @@ crownstone-uart==2.1.0 datadog==0.15.0 # homeassistant.components.metoffice -datapoint==0.9.9 +datapoint==0.10.0 # homeassistant.components.bluetooth dbus-fast==2.24.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 007ab7a3fa393..62dcd33b5ad8a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -143,7 +143,7 @@ afsapi==0.2.7 agent-py==0.0.24 # homeassistant.components.geo_json_events -aio-geojson-generic-client==0.4 +aio-geojson-generic-client==0.5 # homeassistant.components.geonetnz_quakes aio-geojson-geonetnz-quakes==0.16 @@ -619,7 +619,7 @@ crownstone-uart==2.1.0 datadog==0.15.0 # homeassistant.components.metoffice -datapoint==0.9.9 +datapoint==0.10.0 # homeassistant.components.bluetooth dbus-fast==2.24.3 diff --git a/tests/components/metoffice/conftest.py b/tests/components/metoffice/conftest.py index 83c7e7853f7f9..dc64cc8dfb103 100644 --- a/tests/components/metoffice/conftest.py +++ b/tests/components/metoffice/conftest.py @@ -9,10 +9,9 @@ @pytest.fixture def mock_simple_manager_fail(): """Mock datapoint Manager with default values for testing in config_flow.""" - with patch("datapoint.Manager") as mock_manager: + with patch("datapoint.Manager.Manager") as mock_manager: instance = mock_manager.return_value - instance.get_nearest_forecast_site.side_effect = APIException() - instance.get_forecast_for_site.side_effect = APIException() + instance.get_forecast = APIException() instance.latitude = None instance.longitude = None instance.site = None diff --git a/tests/components/metoffice/const.py b/tests/components/metoffice/const.py index 8fe1b42ca590b..189e5e68242ad 100644 --- a/tests/components/metoffice/const.py +++ b/tests/components/metoffice/const.py @@ -3,7 +3,7 @@ from homeassistant.components.metoffice.const import DOMAIN from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME -TEST_DATETIME_STRING = "2020-04-25T12:00:00+00:00" +TEST_DATETIME_STRING = "2024-11-23T12:00:00+00:00" TEST_API_KEY = "test-metoffice-api-key" @@ -34,31 +34,21 @@ } KINGSLYNN_SENSOR_RESULTS = { - "weather": ("weather", "sunny"), - "visibility": ("visibility", "Very Good"), - "visibility_distance": ("visibility_distance", "20-40"), - "temperature": ("temperature", "14"), - "feels_like_temperature": ("feels_like_temperature", "13"), - "uv": ("uv_index", "6"), - "precipitation": ("probability_of_precipitation", "0"), - "wind_direction": ("wind_direction", "E"), - "wind_gust": ("wind_gust", "7"), - "wind_speed": ("wind_speed", "2"), - "humidity": ("humidity", "60"), + "significantWeatherCode": ("significantWeatherCode", "rainy"), + "screenTemperature": ("screenTemperature", "7.87"), + "uvIndex": ("uvIndex", "1"), + "probOfPrecipitation": ("probOfPrecipitation", "67"), + "mslp": ("mslp", "998.20"), + "windSpeed10m": ("windSpeed10m", "22.21"), } WAVERTREE_SENSOR_RESULTS = { - "weather": ("weather", "sunny"), - "visibility": ("visibility", "Good"), - "visibility_distance": ("visibility_distance", "10-20"), - "temperature": ("temperature", "17"), - "feels_like_temperature": ("feels_like_temperature", "14"), - "uv": ("uv_index", "5"), - "precipitation": ("probability_of_precipitation", "0"), - "wind_direction": ("wind_direction", "SSE"), - "wind_gust": ("wind_gust", "16"), - "wind_speed": ("wind_speed", "9"), - "humidity": ("humidity", "50"), + "significantWeatherCode": ("significantWeatherCode", "rainy"), + "screenTemperature": ("screenTemperature", "9.28"), + "uvIndex": ("uvIndex", "1"), + "probOfPrecipitation": ("probOfPrecipitation", "61"), + "mslp": ("mslp", "987.50"), + "windSpeed10m": ("windSpeed10m", "17.60"), } DEVICE_KEY_KINGSLYNN = {(DOMAIN, TEST_COORDINATES_KINGSLYNN)} diff --git a/tests/components/metoffice/fixtures/metoffice.json b/tests/components/metoffice/fixtures/metoffice.json index 68ba02b542944..70ed76e779c1a 100644 --- a/tests/components/metoffice/fixtures/metoffice.json +++ b/tests/components/metoffice/fixtures/metoffice.json @@ -23,1731 +23,4134 @@ ] } }, - "wavertree_hourly": { - "SiteRep": { - "Wx": { - "Param": [ - { - "name": "F", - "units": "C", - "$": "Feels Like Temperature" - }, - { - "name": "G", - "units": "mph", - "$": "Wind Gust" - }, - { - "name": "H", - "units": "%", - "$": "Screen Relative Humidity" - }, - { - "name": "T", - "units": "C", - "$": "Temperature" - }, - { - "name": "V", - "units": "", - "$": "Visibility" - }, - { - "name": "D", - "units": "compass", - "$": "Wind Direction" - }, - { - "name": "S", - "units": "mph", - "$": "Wind Speed" + "wavertree_daily": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-2.9256, 53.3986, 47] + }, + "properties": { + "location": { + "name": "Wavertree" }, - { - "name": "U", - "units": "", - "$": "Max UV Index" + "requestPointDistance": 1975.3601, + "modelRunDate": "2024-11-23T12:00Z", + "timeSeries": [ + { + "time": "2024-11-22T00:00Z", + "midday10MWindSpeed": 6.38, + "midnight10MWindSpeed": 2.78, + "midday10MWindDirection": 261, + "midnight10MWindDirection": 155, + "midday10MWindGust": 9.77, + "midnight10MWindGust": 8.75, + "middayVisibility": 29980, + "midnightVisibility": 18024, + "middayRelativeHumidity": 73.47, + "midnightRelativeHumidity": 86.1, + "middayMslp": 100790, + "midnightMslp": 101020, + "nightSignificantWeatherCode": 12, + "dayMaxScreenTemperature": 7.17, + "nightMinScreenTemperature": 2, + "dayUpperBoundMaxTemp": 7.78, + "nightUpperBoundMinTemp": 3.84, + "dayLowerBoundMaxTemp": 4.64, + "nightLowerBoundMinTemp": 1.18, + "nightMinFeelsLikeTemp": -3.07, + "dayUpperBoundMaxFeelsLikeTemp": 4.39, + "nightUpperBoundMinFeelsLikeTemp": -1.33, + "dayLowerBoundMaxFeelsLikeTemp": 2.49, + "nightLowerBoundMinFeelsLikeTemp": -4.04, + "nightProbabilityOfPrecipitation": 95, + "nightProbabilityOfSnow": 5, + "nightProbabilityOfHeavySnow": 0, + "nightProbabilityOfRain": 93, + "nightProbabilityOfHeavyRain": 90, + "nightProbabilityOfHail": 20, + "nightProbabilityOfSferics": 9 + }, + { + "time": "2024-11-23T00:00Z", + "midday10MWindSpeed": 7.87, + "midnight10MWindSpeed": 7.44, + "midday10MWindDirection": 176, + "midnight10MWindDirection": 171, + "midday10MWindGust": 15.43, + "midnight10MWindGust": 14.08, + "middayVisibility": 5106, + "midnightVisibility": 39734, + "middayRelativeHumidity": 95.13, + "midnightRelativeHumidity": 86.99, + "middayMslp": 98750, + "midnightMslp": 98490, + "maxUvIndex": 1, + "daySignificantWeatherCode": 12, + "nightSignificantWeatherCode": 12, + "dayMaxScreenTemperature": 12.56, + "nightMinScreenTemperature": 11.46, + "dayUpperBoundMaxTemp": 14.48, + "nightUpperBoundMinTemp": 13.92, + "dayLowerBoundMaxTemp": 11.63, + "nightLowerBoundMinTemp": 10.7, + "dayMaxFeelsLikeTemp": 9.81, + "nightMinFeelsLikeTemp": 9.53, + "dayUpperBoundMaxFeelsLikeTemp": 12.68, + "nightUpperBoundMinFeelsLikeTemp": 11.39, + "dayLowerBoundMaxFeelsLikeTemp": 9.81, + "nightLowerBoundMinFeelsLikeTemp": 9.53, + "dayProbabilityOfPrecipitation": 65, + "nightProbabilityOfPrecipitation": 74, + "dayProbabilityOfSnow": 3, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 65, + "nightProbabilityOfRain": 74, + "dayProbabilityOfHeavyRain": 41, + "nightProbabilityOfHeavyRain": 73, + "dayProbabilityOfHail": 3, + "nightProbabilityOfHail": 15, + "dayProbabilityOfSferics": 2, + "nightProbabilityOfSferics": 12 + }, + { + "time": "2024-11-24T00:00Z", + "midday10MWindSpeed": 6.65, + "midnight10MWindSpeed": 7.33, + "midday10MWindDirection": 203, + "midnight10MWindDirection": 211, + "midday10MWindGust": 11.85, + "midnight10MWindGust": 13.11, + "middayVisibility": 36358, + "midnightVisibility": 51563, + "middayRelativeHumidity": 70.26, + "midnightRelativeHumidity": 72.97, + "middayMslp": 98748, + "midnightMslp": 98712, + "maxUvIndex": 1, + "daySignificantWeatherCode": 7, + "nightSignificantWeatherCode": 7, + "dayMaxScreenTemperature": 12.7, + "nightMinScreenTemperature": 8.21, + "dayUpperBoundMaxTemp": 15.19, + "nightUpperBoundMinTemp": 10.67, + "dayLowerBoundMaxTemp": 11.87, + "nightLowerBoundMinTemp": 7.03, + "dayMaxFeelsLikeTemp": 9.17, + "nightMinFeelsLikeTemp": 4.84, + "dayUpperBoundMaxFeelsLikeTemp": 12.63, + "nightUpperBoundMinFeelsLikeTemp": 7.25, + "dayLowerBoundMaxFeelsLikeTemp": 9.17, + "nightLowerBoundMinFeelsLikeTemp": 3.81, + "dayProbabilityOfPrecipitation": 26, + "nightProbabilityOfPrecipitation": 23, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 26, + "nightProbabilityOfRain": 23, + "dayProbabilityOfHeavyRain": 13, + "nightProbabilityOfHeavyRain": 16, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 3, + "dayProbabilityOfSferics": 3, + "nightProbabilityOfSferics": 2 + }, + { + "time": "2024-11-25T00:00Z", + "midday10MWindSpeed": 8.52, + "midnight10MWindSpeed": 8.12, + "midday10MWindDirection": 251, + "midnight10MWindDirection": 262, + "midday10MWindGust": 14.49, + "midnight10MWindGust": 13.33, + "middayVisibility": 32255, + "midnightVisibility": 36209, + "middayRelativeHumidity": 68.89, + "midnightRelativeHumidity": 72.82, + "middayMslp": 99488, + "midnightMslp": 100481, + "maxUvIndex": 1, + "daySignificantWeatherCode": 3, + "nightSignificantWeatherCode": 2, + "dayMaxScreenTemperature": 9.81, + "nightMinScreenTemperature": 7.71, + "dayUpperBoundMaxTemp": 10.98, + "nightUpperBoundMinTemp": 9.31, + "dayLowerBoundMaxTemp": 8.42, + "nightLowerBoundMinTemp": 4.42, + "dayMaxFeelsLikeTemp": 5.33, + "nightMinFeelsLikeTemp": 4.19, + "dayUpperBoundMaxFeelsLikeTemp": 7.12, + "nightUpperBoundMinFeelsLikeTemp": 5.29, + "dayLowerBoundMaxFeelsLikeTemp": 4.86, + "nightLowerBoundMinFeelsLikeTemp": 3.1, + "dayProbabilityOfPrecipitation": 5, + "nightProbabilityOfPrecipitation": 6, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 5, + "nightProbabilityOfRain": 6, + "dayProbabilityOfHeavyRain": 3, + "nightProbabilityOfHeavyRain": 5, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 1, + "dayProbabilityOfSferics": 1, + "nightProbabilityOfSferics": 1 + }, + { + "time": "2024-11-26T00:00Z", + "midday10MWindSpeed": 5.68, + "midnight10MWindSpeed": 3.17, + "midday10MWindDirection": 265, + "midnight10MWindDirection": 74, + "midday10MWindGust": 9.58, + "midnight10MWindGust": 5.42, + "middayVisibility": 34027, + "midnightVisibility": 12383, + "middayRelativeHumidity": 70.41, + "midnightRelativeHumidity": 89.82, + "middayMslp": 101293, + "midnightMslp": 101390, + "maxUvIndex": 1, + "daySignificantWeatherCode": 3, + "nightSignificantWeatherCode": 7, + "dayMaxScreenTemperature": 8.72, + "nightMinScreenTemperature": 3.76, + "dayUpperBoundMaxTemp": 10.14, + "nightUpperBoundMinTemp": 7.47, + "dayLowerBoundMaxTemp": 6.46, + "nightLowerBoundMinTemp": -0.43, + "dayMaxFeelsLikeTemp": 5.9, + "nightMinFeelsLikeTemp": 1.31, + "dayUpperBoundMaxFeelsLikeTemp": 7.37, + "nightUpperBoundMinFeelsLikeTemp": 4.37, + "dayLowerBoundMaxFeelsLikeTemp": 3.99, + "nightLowerBoundMinFeelsLikeTemp": -3.09, + "dayProbabilityOfPrecipitation": 6, + "nightProbabilityOfPrecipitation": 44, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 1, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 1, + "dayProbabilityOfRain": 6, + "nightProbabilityOfRain": 44, + "dayProbabilityOfHeavyRain": 5, + "nightProbabilityOfHeavyRain": 24, + "dayProbabilityOfHail": 1, + "nightProbabilityOfHail": 2, + "dayProbabilityOfSferics": 1, + "nightProbabilityOfSferics": 1 + }, + { + "time": "2024-11-27T00:00Z", + "midday10MWindSpeed": 5.15, + "midnight10MWindSpeed": 3.29, + "midday10MWindDirection": 8, + "midnight10MWindDirection": 31, + "midday10MWindGust": 8.94, + "midnight10MWindGust": 5.54, + "middayVisibility": 25011, + "midnightVisibility": 31513, + "middayRelativeHumidity": 81.23, + "midnightRelativeHumidity": 86.67, + "middayMslp": 101439, + "midnightMslp": 102175, + "maxUvIndex": 1, + "daySignificantWeatherCode": 10, + "nightSignificantWeatherCode": 0, + "dayMaxScreenTemperature": 6.66, + "nightMinScreenTemperature": 2.36, + "dayUpperBoundMaxTemp": 11.14, + "nightUpperBoundMinTemp": 7.25, + "dayLowerBoundMaxTemp": 3.03, + "nightLowerBoundMinTemp": -3.02, + "dayMaxFeelsLikeTemp": 3.31, + "nightMinFeelsLikeTemp": 0.18, + "dayUpperBoundMaxFeelsLikeTemp": 9.03, + "nightUpperBoundMinFeelsLikeTemp": 3.85, + "dayLowerBoundMaxFeelsLikeTemp": 1.04, + "nightLowerBoundMinFeelsLikeTemp": -7.6, + "dayProbabilityOfPrecipitation": 43, + "nightProbabilityOfPrecipitation": 9, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 3, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 43, + "nightProbabilityOfRain": 8, + "dayProbabilityOfHeavyRain": 24, + "nightProbabilityOfHeavyRain": 7, + "dayProbabilityOfHail": 1, + "nightProbabilityOfHail": 1, + "dayProbabilityOfSferics": 3, + "nightProbabilityOfSferics": 1 + }, + { + "time": "2024-11-28T00:00Z", + "midday10MWindSpeed": 3.51, + "midnight10MWindSpeed": 5.57, + "midday10MWindDirection": 104, + "midnight10MWindDirection": 131, + "midday10MWindGust": 6.21, + "midnight10MWindGust": 9.21, + "middayVisibility": 28173, + "midnightVisibility": 33839, + "middayRelativeHumidity": 85.35, + "midnightRelativeHumidity": 86.07, + "middayMslp": 102512, + "midnightMslp": 102382, + "maxUvIndex": 1, + "daySignificantWeatherCode": 7, + "nightSignificantWeatherCode": 7, + "dayMaxScreenTemperature": 5.73, + "nightMinScreenTemperature": 3.79, + "dayUpperBoundMaxTemp": 9.42, + "nightUpperBoundMinTemp": 8.18, + "dayLowerBoundMaxTemp": 1.26, + "nightLowerBoundMinTemp": -1.91, + "dayMaxFeelsLikeTemp": 2.95, + "nightMinFeelsLikeTemp": 1.63, + "dayUpperBoundMaxFeelsLikeTemp": 7.21, + "nightUpperBoundMinFeelsLikeTemp": 4.13, + "dayLowerBoundMaxFeelsLikeTemp": -0.81, + "nightLowerBoundMinFeelsLikeTemp": -5.94, + "dayProbabilityOfPrecipitation": 9, + "nightProbabilityOfPrecipitation": 9, + "dayProbabilityOfSnow": 2, + "nightProbabilityOfSnow": 1, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 9, + "nightProbabilityOfRain": 9, + "dayProbabilityOfHeavyRain": 3, + "nightProbabilityOfHeavyRain": 3, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 0, + "dayProbabilityOfSferics": 0, + "nightProbabilityOfSferics": 0 + }, + { + "time": "2024-11-29T00:00Z", + "midday10MWindSpeed": 6.39, + "midnight10MWindSpeed": 5.59, + "midday10MWindDirection": 137, + "midnight10MWindDirection": 151, + "midday10MWindGust": 10.72, + "midnight10MWindGust": 9.21, + "middayVisibility": 34870, + "midnightVisibility": 31318, + "middayRelativeHumidity": 83.78, + "midnightRelativeHumidity": 87.71, + "middayMslp": 101985, + "midnightMslp": 101688, + "maxUvIndex": 1, + "daySignificantWeatherCode": 7, + "nightSignificantWeatherCode": 7, + "dayMaxScreenTemperature": 8.21, + "nightMinScreenTemperature": 7.04, + "dayUpperBoundMaxTemp": 12.62, + "nightUpperBoundMinTemp": 10.76, + "dayLowerBoundMaxTemp": 4.15, + "nightLowerBoundMinTemp": -1.9, + "dayMaxFeelsLikeTemp": 4.88, + "nightMinFeelsLikeTemp": 4.95, + "dayUpperBoundMaxFeelsLikeTemp": 10.74, + "nightUpperBoundMinFeelsLikeTemp": 9.04, + "dayLowerBoundMaxFeelsLikeTemp": 0.63, + "nightLowerBoundMinFeelsLikeTemp": -6.49, + "dayProbabilityOfPrecipitation": 11, + "nightProbabilityOfPrecipitation": 13, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 11, + "nightProbabilityOfRain": 13, + "dayProbabilityOfHeavyRain": 4, + "nightProbabilityOfHeavyRain": 6, + "dayProbabilityOfHail": 1, + "nightProbabilityOfHail": 0, + "dayProbabilityOfSferics": 0, + "nightProbabilityOfSferics": 1 + } + ] + } + } + ], + "parameters": [ + { + "daySignificantWeatherCode": { + "type": "Parameter", + "description": "Day Significant Weather Code", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "https://datahub.metoffice.gov.uk/", + "type": "1" + } + } + }, + "midnightRelativeHumidity": { + "type": "Parameter", + "description": "Relative Humidity at Local Midnight", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightProbabilityOfHeavyRain": { + "type": "Parameter", + "description": "Probability of Heavy Rain During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "midnight10MWindSpeed": { + "type": "Parameter", + "description": "10m Wind Speed at Local Midnight", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "nightUpperBoundMinFeelsLikeTemp": { + "type": "Parameter", + "description": "Upper Bound on Night Minimum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightUpperBoundMinTemp": { + "type": "Parameter", + "description": "Upper Bound on Night Minimum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "midnightVisibility": { + "type": "Parameter", + "description": "Visibility at Local Midnight", + "unit": { + "label": "metres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m" + } + } + }, + "dayUpperBoundMaxFeelsLikeTemp": { + "type": "Parameter", + "description": "Upper Bound on Day Maximum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfRain": { + "type": "Parameter", + "description": "Probability of Rain During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "midday10MWindDirection": { + "type": "Parameter", + "description": "10m Wind Direction at Local Midday", + "unit": { + "label": "degrees", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "deg" + } + } + }, + "nightLowerBoundMinFeelsLikeTemp": { + "type": "Parameter", + "description": "Lower Bound on Night Minimum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfHail": { + "type": "Parameter", + "description": "Probability of Hail During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "middayMslp": { + "type": "Parameter", + "description": "Mean Sea Level Pressure at Local Midday", + "unit": { + "label": "pascals", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Pa" + } + } + }, + "dayProbabilityOfHeavySnow": { + "type": "Parameter", + "description": "Probability of Heavy Snow During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightProbabilityOfPrecipitation": { + "type": "Parameter", + "description": "Probability of Precipitation During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayProbabilityOfHail": { + "type": "Parameter", + "description": "Probability of Hail During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayProbabilityOfRain": { + "type": "Parameter", + "description": "Probability of Rain During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "midday10MWindSpeed": { + "type": "Parameter", + "description": "10m Wind Speed at Local Midday", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "midday10MWindGust": { + "type": "Parameter", + "description": "10m Wind Gust Speed at Local Midday", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "middayVisibility": { + "type": "Parameter", + "description": "Visibility at Local Midday", + "unit": { + "label": "metres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m" + } + } + }, + "midnight10MWindGust": { + "type": "Parameter", + "description": "10m Wind Gust Speed at Local Midnight", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "midnightMslp": { + "type": "Parameter", + "description": "Mean Sea Level Pressure at Local Midnight", + "unit": { + "label": "pascals", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Pa" + } + } + }, + "dayProbabilityOfSferics": { + "type": "Parameter", + "description": "Probability of Sferics During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightSignificantWeatherCode": { + "type": "Parameter", + "description": "Night Significant Weather Code", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "https://datahub.metoffice.gov.uk/", + "type": "1" + } + } + }, + "dayProbabilityOfPrecipitation": { + "type": "Parameter", + "description": "Probability of Precipitation During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayProbabilityOfHeavyRain": { + "type": "Parameter", + "description": "Probability of Heavy Rain During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayMaxScreenTemperature": { + "type": "Parameter", + "description": "Day Maximum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightMinScreenTemperature": { + "type": "Parameter", + "description": "Night Minimum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "midnight10MWindDirection": { + "type": "Parameter", + "description": "10m Wind Direction at Local Midnight", + "unit": { + "label": "degrees", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "deg" + } + } + }, + "maxUvIndex": { + "type": "Parameter", + "description": "Day Maximum UV Index", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "1" + } + } + }, + "dayProbabilityOfSnow": { + "type": "Parameter", + "description": "Probability of Snow During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightProbabilityOfSnow": { + "type": "Parameter", + "description": "Probability of Snow During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayLowerBoundMaxTemp": { + "type": "Parameter", + "description": "Lower Bound on Day Maximum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfHeavySnow": { + "type": "Parameter", + "description": "Probability of Heavy Snow During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayLowerBoundMaxFeelsLikeTemp": { + "type": "Parameter", + "description": "Lower Bound on Day Maximum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "dayUpperBoundMaxTemp": { + "type": "Parameter", + "description": "Upper Bound on Day Maximum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "dayMaxFeelsLikeTemp": { + "type": "Parameter", + "description": "Day Maximum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "middayRelativeHumidity": { + "type": "Parameter", + "description": "Relative Humidity at Local Midday", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightLowerBoundMinTemp": { + "type": "Parameter", + "description": "Lower Bound on Night Minimum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightMinFeelsLikeTemp": { + "type": "Parameter", + "description": "Night Minimum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfSferics": { + "type": "Parameter", + "description": "Probability of Sferics During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + } + } + ] + }, + "wavertree_hourly": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-2.9256, 53.3986, 47] + }, + "properties": { + "location": { + "name": "Wavertree" }, - { - "name": "W", - "units": "", - "$": "Weather Type" + "requestPointDistance": 1975.3601, + "modelRunDate": "2024-11-23T12:00Z", + "timeSeries": [ + { + "time": "2024-11-23T12:00Z", + "screenTemperature": 9.28, + "maxScreenAirTemp": 9.28, + "minScreenAirTemp": 8.14, + "screenDewPointTemperature": 8.54, + "feelsLikeTemperature": 5.75, + "windSpeed10m": 7.87, + "windDirectionFrom10m": 176, + "windGustSpeed10m": 15.43, + "max10mWindGust": 19.04, + "visibility": 5106, + "screenRelativeHumidity": 95.13, + "mslp": 98750, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.53, + "totalPrecipAmount": 0.25, + "totalSnowAmount": 0, + "probOfPrecipitation": 61 + }, + { + "time": "2024-11-23T13:00Z", + "screenTemperature": 9.93, + "maxScreenAirTemp": 9.93, + "minScreenAirTemp": 9.28, + "screenDewPointTemperature": 8.97, + "feelsLikeTemperature": 6.8, + "windSpeed10m": 7.06, + "windDirectionFrom10m": 178, + "windGustSpeed10m": 15.48, + "max10mWindGust": 18.1, + "visibility": 11368, + "screenRelativeHumidity": 93.78, + "mslp": 98683, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.82, + "totalPrecipAmount": 0.52, + "totalSnowAmount": 0, + "probOfPrecipitation": 65 + }, + { + "time": "2024-11-23T14:00Z", + "screenTemperature": 11.13, + "maxScreenAirTemp": 11.14, + "minScreenAirTemp": 9.93, + "screenDewPointTemperature": 9.99, + "feelsLikeTemperature": 8.41, + "windSpeed10m": 6.35, + "windDirectionFrom10m": 179, + "windGustSpeed10m": 13.61, + "max10mWindGust": 15.05, + "visibility": 18523, + "screenRelativeHumidity": 92.73, + "mslp": 98634, + "uvIndex": 1, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 12 + }, + { + "time": "2024-11-23T15:00Z", + "screenTemperature": 11.98, + "maxScreenAirTemp": 12.03, + "minScreenAirTemp": 11.13, + "screenDewPointTemperature": 10.75, + "feelsLikeTemperature": 9.81, + "windSpeed10m": 5.14, + "windDirectionFrom10m": 182, + "windGustSpeed10m": 11.14, + "max10mWindGust": 13.9, + "visibility": 17498, + "screenRelativeHumidity": 92.28, + "mslp": 98613, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.7, + "totalPrecipAmount": 0.09, + "totalSnowAmount": 0, + "probOfPrecipitation": 37 + }, + { + "time": "2024-11-23T16:00Z", + "screenTemperature": 12.56, + "maxScreenAirTemp": 12.59, + "minScreenAirTemp": 11.98, + "screenDewPointTemperature": 11.33, + "feelsLikeTemperature": 10.83, + "windSpeed10m": 4.29, + "windDirectionFrom10m": 197, + "windGustSpeed10m": 9.96, + "max10mWindGust": 10.5, + "visibility": 16335, + "screenRelativeHumidity": 92.27, + "mslp": 98660, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 1.23, + "totalPrecipAmount": 0.27, + "totalSnowAmount": 0, + "probOfPrecipitation": 36 + }, + { + "time": "2024-11-23T17:00Z", + "screenTemperature": 12.95, + "maxScreenAirTemp": 12.99, + "minScreenAirTemp": 12.56, + "screenDewPointTemperature": 11.75, + "feelsLikeTemperature": 11.27, + "windSpeed10m": 4.33, + "windDirectionFrom10m": 203, + "windGustSpeed10m": 9.88, + "max10mWindGust": 10.47, + "visibility": 18682, + "screenRelativeHumidity": 92.39, + "mslp": 98710, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 11 + }, + { + "time": "2024-11-23T18:00Z", + "screenTemperature": 13, + "maxScreenAirTemp": 13.05, + "minScreenAirTemp": 12.9, + "screenDewPointTemperature": 11.56, + "feelsLikeTemperature": 11.32, + "windSpeed10m": 4.31, + "windDirectionFrom10m": 177, + "windGustSpeed10m": 8.67, + "max10mWindGust": 9.95, + "visibility": 19530, + "screenRelativeHumidity": 91, + "mslp": 98710, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 7 + }, + { + "time": "2024-11-23T19:00Z", + "screenTemperature": 13.02, + "maxScreenAirTemp": 13.16, + "minScreenAirTemp": 13, + "screenDewPointTemperature": 11.92, + "feelsLikeTemperature": 11.12, + "windSpeed10m": 4.85, + "windDirectionFrom10m": 177, + "windGustSpeed10m": 10.4, + "max10mWindGust": 11.01, + "visibility": 13803, + "screenRelativeHumidity": 93.07, + "mslp": 98682, + "uvIndex": 0, + "significantWeatherCode": 13, + "precipitationRate": 5.45, + "totalPrecipAmount": 0.51, + "totalSnowAmount": 0, + "probOfPrecipitation": 74 + }, + { + "time": "2024-11-23T20:00Z", + "screenTemperature": 13.67, + "maxScreenAirTemp": 13.72, + "minScreenAirTemp": 13.02, + "screenDewPointTemperature": 12.07, + "feelsLikeTemperature": 11.23, + "windSpeed10m": 6.31, + "windDirectionFrom10m": 187, + "windGustSpeed10m": 12.77, + "max10mWindGust": 13.53, + "visibility": 28855, + "screenRelativeHumidity": 90.06, + "mslp": 98692, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 11 + }, + { + "time": "2024-11-23T21:00Z", + "screenTemperature": 14.02, + "maxScreenAirTemp": 14.03, + "minScreenAirTemp": 13.67, + "screenDewPointTemperature": 11.71, + "feelsLikeTemperature": 11.65, + "windSpeed10m": 6.11, + "windDirectionFrom10m": 178, + "windGustSpeed10m": 12.31, + "max10mWindGust": 13.07, + "visibility": 34707, + "screenRelativeHumidity": 86.02, + "mslp": 98682, + "uvIndex": 0, + "significantWeatherCode": 9, + "precipitationRate": 0.35, + "totalPrecipAmount": 0.11, + "totalSnowAmount": 0, + "probOfPrecipitation": 30 + }, + { + "time": "2024-11-23T22:00Z", + "screenTemperature": 13.98, + "maxScreenAirTemp": 14.02, + "minScreenAirTemp": 13.9, + "screenDewPointTemperature": 11.78, + "feelsLikeTemperature": 11.43, + "windSpeed10m": 6.57, + "windDirectionFrom10m": 176, + "windGustSpeed10m": 13.29, + "max10mWindGust": 14.34, + "visibility": 37141, + "screenRelativeHumidity": 86.59, + "mslp": 98631, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 12 + }, + { + "time": "2024-11-23T23:00Z", + "screenTemperature": 14.28, + "maxScreenAirTemp": 14.29, + "minScreenAirTemp": 13.98, + "screenDewPointTemperature": 12.06, + "feelsLikeTemperature": 11.42, + "windSpeed10m": 7.38, + "windDirectionFrom10m": 176, + "windGustSpeed10m": 14.29, + "max10mWindGust": 15.45, + "visibility": 37580, + "screenRelativeHumidity": 86.56, + "mslp": 98571, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 10 + }, + { + "time": "2024-11-24T00:00Z", + "screenTemperature": 14.4, + "maxScreenAirTemp": 14.44, + "minScreenAirTemp": 14.28, + "screenDewPointTemperature": 12.25, + "feelsLikeTemperature": 11.52, + "windSpeed10m": 7.44, + "windDirectionFrom10m": 171, + "windGustSpeed10m": 14.08, + "max10mWindGust": 14.92, + "visibility": 39734, + "screenRelativeHumidity": 86.99, + "mslp": 98492, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 10 + }, + { + "time": "2024-11-24T01:00Z", + "screenTemperature": 14.38, + "maxScreenAirTemp": 14.42, + "minScreenAirTemp": 14.35, + "screenDewPointTemperature": 12.25, + "feelsLikeTemperature": 11.62, + "windSpeed10m": 7.16, + "windDirectionFrom10m": 170, + "windGustSpeed10m": 13.92, + "max10mWindGust": 14.5, + "visibility": 39173, + "screenRelativeHumidity": 87.03, + "mslp": 98422, + "uvIndex": 0, + "significantWeatherCode": 9, + "precipitationRate": 1.24, + "totalPrecipAmount": 0.17, + "totalSnowAmount": 0, + "probOfPrecipitation": 40 + }, + { + "time": "2024-11-24T02:00Z", + "screenTemperature": 14.19, + "maxScreenAirTemp": 14.38, + "minScreenAirTemp": 14.16, + "screenDewPointTemperature": 12.49, + "feelsLikeTemperature": 11.33, + "windSpeed10m": 7.47, + "windDirectionFrom10m": 176, + "windGustSpeed10m": 14.46, + "max10mWindGust": 15.43, + "visibility": 31444, + "screenRelativeHumidity": 89.63, + "mslp": 98351, + "uvIndex": 0, + "significantWeatherCode": 13, + "precipitationRate": 2.07, + "totalPrecipAmount": 0.21, + "totalSnowAmount": 0, + "probOfPrecipitation": 74 + }, + { + "time": "2024-11-24T03:00Z", + "screenTemperature": 14.44, + "maxScreenAirTemp": 14.48, + "minScreenAirTemp": 14.19, + "screenDewPointTemperature": 12.35, + "feelsLikeTemperature": 11.65, + "windSpeed10m": 7.25, + "windDirectionFrom10m": 187, + "windGustSpeed10m": 14.32, + "max10mWindGust": 15.51, + "visibility": 20239, + "screenRelativeHumidity": 87.4, + "mslp": 98310, + "uvIndex": 0, + "significantWeatherCode": 13, + "precipitationRate": 2.63, + "totalPrecipAmount": 0.34, + "totalSnowAmount": 0, + "probOfPrecipitation": 73 + }, + { + "time": "2024-11-24T04:00Z", + "screenTemperature": 14.42, + "maxScreenAirTemp": 14.45, + "minScreenAirTemp": 14.37, + "screenDewPointTemperature": 12.28, + "feelsLikeTemperature": 11.68, + "windSpeed10m": 7.09, + "windDirectionFrom10m": 189, + "windGustSpeed10m": 13.8, + "max10mWindGust": 15.24, + "visibility": 24690, + "screenRelativeHumidity": 87.07, + "mslp": 98310, + "uvIndex": 0, + "significantWeatherCode": 9, + "precipitationRate": 1.32, + "totalPrecipAmount": 0.28, + "totalSnowAmount": 0, + "probOfPrecipitation": 50 + }, + { + "time": "2024-11-24T05:00Z", + "screenTemperature": 14.31, + "maxScreenAirTemp": 14.42, + "minScreenAirTemp": 14.11, + "screenDewPointTemperature": 12.17, + "feelsLikeTemperature": 11.79, + "windSpeed10m": 6.58, + "windDirectionFrom10m": 202, + "windGustSpeed10m": 12.7, + "max10mWindGust": 14.06, + "visibility": 25995, + "screenRelativeHumidity": 87.01, + "mslp": 98330, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.65, + "totalPrecipAmount": 0.25, + "totalSnowAmount": 0, + "probOfPrecipitation": 47 + }, + { + "time": "2024-11-24T06:00Z", + "screenTemperature": 13.43, + "maxScreenAirTemp": 14.31, + "minScreenAirTemp": 13.41, + "screenDewPointTemperature": 10.33, + "feelsLikeTemperature": 10.74, + "windSpeed10m": 6.71, + "windDirectionFrom10m": 216, + "windGustSpeed10m": 12.73, + "max10mWindGust": 13.79, + "visibility": 27446, + "screenRelativeHumidity": 81.67, + "mslp": 98396, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 1.04, + "totalPrecipAmount": 0.3, + "totalSnowAmount": 0, + "probOfPrecipitation": 42 + }, + { + "time": "2024-11-24T07:00Z", + "screenTemperature": 12.48, + "maxScreenAirTemp": 13.43, + "minScreenAirTemp": 12.47, + "screenDewPointTemperature": 9.48, + "feelsLikeTemperature": 10.09, + "windSpeed10m": 5.72, + "windDirectionFrom10m": 214, + "windGustSpeed10m": 11.03, + "max10mWindGust": 12.54, + "visibility": 24289, + "screenRelativeHumidity": 81.94, + "mslp": 98458, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 1.17, + "totalPrecipAmount": 0.16, + "totalSnowAmount": 0, + "probOfPrecipitation": 40 + }, + { + "time": "2024-11-24T08:00Z", + "screenTemperature": 11.88, + "maxScreenAirTemp": 12.48, + "minScreenAirTemp": 11.86, + "screenDewPointTemperature": 8.86, + "feelsLikeTemperature": 9.53, + "windSpeed10m": 5.48, + "windDirectionFrom10m": 209, + "windGustSpeed10m": 10.3, + "max10mWindGust": 11.11, + "visibility": 30442, + "screenRelativeHumidity": 81.73, + "mslp": 98548, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.29, + "totalPrecipAmount": 0.08, + "totalSnowAmount": 0, + "probOfPrecipitation": 38 + }, + { + "time": "2024-11-24T09:00Z", + "screenTemperature": 11.46, + "maxScreenAirTemp": 11.88, + "minScreenAirTemp": 11.45, + "screenDewPointTemperature": 8.21, + "feelsLikeTemperature": 9.06, + "windSpeed10m": 5.44, + "windDirectionFrom10m": 201, + "windGustSpeed10m": 9.99, + "max10mWindGust": 10.31, + "visibility": 28370, + "screenRelativeHumidity": 80.35, + "mslp": 98638, + "uvIndex": 1, + "significantWeatherCode": 10, + "precipitationRate": 0.28, + "totalPrecipAmount": 0.04, + "totalSnowAmount": 0, + "probOfPrecipitation": 26 + }, + { + "time": "2024-11-24T10:00Z", + "screenTemperature": 11.54, + "maxScreenAirTemp": 11.56, + "minScreenAirTemp": 11.46, + "screenDewPointTemperature": 7.52, + "feelsLikeTemperature": 9.03, + "windSpeed10m": 5.72, + "windDirectionFrom10m": 199, + "windGustSpeed10m": 10.28, + "max10mWindGust": 10.83, + "visibility": 29181, + "screenRelativeHumidity": 76.29, + "mslp": 98696, + "uvIndex": 1, + "significantWeatherCode": 10, + "precipitationRate": 0.28, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 25 + }, + { + "time": "2024-11-24T11:00Z", + "screenTemperature": 11.66, + "maxScreenAirTemp": 11.67, + "minScreenAirTemp": 11.54, + "screenDewPointTemperature": 7.29, + "feelsLikeTemperature": 9.17, + "windSpeed10m": 5.68, + "windDirectionFrom10m": 199, + "windGustSpeed10m": 10.06, + "max10mWindGust": 11.06, + "visibility": 33278, + "screenRelativeHumidity": 74.39, + "mslp": 98755, + "uvIndex": 1, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 6 + }, + { + "time": "2024-11-24T12:00Z", + "screenTemperature": 11.82, + "maxScreenAirTemp": 11.84, + "minScreenAirTemp": 11.66, + "screenDewPointTemperature": 6.61, + "feelsLikeTemperature": 8.98, + "windSpeed10m": 6.65, + "windDirectionFrom10m": 203, + "windGustSpeed10m": 11.85, + "max10mWindGust": 12.49, + "visibility": 36358, + "screenRelativeHumidity": 70.26, + "mslp": 98748, + "uvIndex": 1, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T13:00Z", + "screenTemperature": 11.84, + "maxScreenAirTemp": 11.87, + "minScreenAirTemp": 11.82, + "screenDewPointTemperature": 6.06, + "feelsLikeTemperature": 8.85, + "windSpeed10m": 7.07, + "windDirectionFrom10m": 203, + "windGustSpeed10m": 12.6, + "max10mWindGust": 14.16, + "visibility": 38017, + "screenRelativeHumidity": 67.6, + "mslp": 98757, + "uvIndex": 1, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T14:00Z", + "screenTemperature": 11.73, + "maxScreenAirTemp": 11.84, + "minScreenAirTemp": 11.72, + "screenDewPointTemperature": 5.74, + "feelsLikeTemperature": 8.64, + "windSpeed10m": 7.33, + "windDirectionFrom10m": 201, + "windGustSpeed10m": 13.04, + "max10mWindGust": 14.33, + "visibility": 36175, + "screenRelativeHumidity": 66.62, + "mslp": 98737, + "uvIndex": 1, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T15:00Z", + "screenTemperature": 11.61, + "maxScreenAirTemp": 11.73, + "minScreenAirTemp": 11.57, + "screenDewPointTemperature": 5.89, + "feelsLikeTemperature": 8.53, + "windSpeed10m": 7.32, + "windDirectionFrom10m": 198, + "windGustSpeed10m": 13.02, + "max10mWindGust": 15, + "visibility": 35510, + "screenRelativeHumidity": 67.73, + "mslp": 98727, + "uvIndex": 1, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 4 + }, + { + "time": "2024-11-24T16:00Z", + "screenTemperature": 11.25, + "maxScreenAirTemp": 11.61, + "minScreenAirTemp": 11.24, + "screenDewPointTemperature": 5.8, + "feelsLikeTemperature": 8.25, + "windSpeed10m": 7.05, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 12.84, + "max10mWindGust": 14.78, + "visibility": 34357, + "screenRelativeHumidity": 68.9, + "mslp": 98708, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T17:00Z", + "screenTemperature": 11.03, + "maxScreenAirTemp": 11.25, + "minScreenAirTemp": 11.02, + "screenDewPointTemperature": 5.9, + "feelsLikeTemperature": 8.03, + "windSpeed10m": 7.04, + "windDirectionFrom10m": 194, + "windGustSpeed10m": 12.69, + "max10mWindGust": 14.44, + "visibility": 37801, + "screenRelativeHumidity": 70.45, + "mslp": 98689, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 4 + }, + { + "time": "2024-11-24T18:00Z", + "screenTemperature": 10.86, + "maxScreenAirTemp": 11.03, + "minScreenAirTemp": 10.8, + "screenDewPointTemperature": 5.96, + "feelsLikeTemperature": 7.85, + "windSpeed10m": 7.04, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 12.82, + "max10mWindGust": 14.25, + "visibility": 39237, + "screenRelativeHumidity": 71.58, + "mslp": 98670, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T19:00Z", + "screenTemperature": 10.79, + "maxScreenAirTemp": 10.86, + "minScreenAirTemp": 10.75, + "screenDewPointTemperature": 5.92, + "feelsLikeTemperature": 7.81, + "windSpeed10m": 6.93, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 12.62, + "max10mWindGust": 13.94, + "visibility": 40795, + "screenRelativeHumidity": 71.71, + "mslp": 98669, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T20:00Z", + "screenTemperature": 10.65, + "maxScreenAirTemp": 10.79, + "minScreenAirTemp": 10.62, + "screenDewPointTemperature": 5.78, + "feelsLikeTemperature": 7.7, + "windSpeed10m": 6.82, + "windDirectionFrom10m": 202, + "windGustSpeed10m": 12.52, + "max10mWindGust": 13.63, + "visibility": 41929, + "screenRelativeHumidity": 71.7, + "mslp": 98678, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T21:00Z", + "screenTemperature": 10.53, + "maxScreenAirTemp": 10.65, + "minScreenAirTemp": 10.5, + "screenDewPointTemperature": 5.84, + "feelsLikeTemperature": 7.48, + "windSpeed10m": 7.08, + "windDirectionFrom10m": 203, + "windGustSpeed10m": 12.89, + "max10mWindGust": 13.18, + "visibility": 44628, + "screenRelativeHumidity": 72.53, + "mslp": 98677, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-24T22:00Z", + "screenTemperature": 10.47, + "maxScreenAirTemp": 10.53, + "minScreenAirTemp": 10.42, + "screenDewPointTemperature": 5.65, + "feelsLikeTemperature": 7.32, + "windSpeed10m": 7.41, + "windDirectionFrom10m": 204, + "windGustSpeed10m": 13.4, + "max10mWindGust": 13.81, + "visibility": 47105, + "screenRelativeHumidity": 71.84, + "mslp": 98704, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 4 + }, + { + "time": "2024-11-24T23:00Z", + "screenTemperature": 10.32, + "maxScreenAirTemp": 10.47, + "minScreenAirTemp": 10.26, + "screenDewPointTemperature": 5.54, + "feelsLikeTemperature": 7.08, + "windSpeed10m": 7.7, + "windDirectionFrom10m": 207, + "windGustSpeed10m": 14.01, + "max10mWindGust": 14.01, + "visibility": 52166, + "screenRelativeHumidity": 72.03, + "mslp": 98704, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-25T00:00Z", + "screenTemperature": 10.22, + "maxScreenAirTemp": 10.32, + "minScreenAirTemp": 10.06, + "screenDewPointTemperature": 5.64, + "feelsLikeTemperature": 7.09, + "windSpeed10m": 7.33, + "windDirectionFrom10m": 211, + "windGustSpeed10m": 13.11, + "max10mWindGust": 13.65, + "visibility": 51563, + "screenRelativeHumidity": 72.97, + "mslp": 98712, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 23 + }, + { + "time": "2024-11-25T01:00Z", + "screenTemperature": 9.98, + "maxScreenAirTemp": 10.22, + "minScreenAirTemp": 9.94, + "screenDewPointTemperature": 5.98, + "feelsLikeTemperature": 6.88, + "windSpeed10m": 7.04, + "windDirectionFrom10m": 215, + "windGustSpeed10m": 12.51, + "max10mWindGust": 12.51, + "visibility": 52180, + "screenRelativeHumidity": 76.02, + "mslp": 98741, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 11 + }, + { + "time": "2024-11-25T02:00Z", + "screenTemperature": 9.59, + "maxScreenAirTemp": 9.98, + "minScreenAirTemp": 9.53, + "screenDewPointTemperature": 5.22, + "feelsLikeTemperature": 6.37, + "windSpeed10m": 7.14, + "windDirectionFrom10m": 222, + "windGustSpeed10m": 13.02, + "max10mWindGust": 13.02, + "visibility": 41536, + "screenRelativeHumidity": 74.07, + "mslp": 98788, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 7 + }, + { + "time": "2024-11-25T03:00Z", + "screenTemperature": 9.27, + "maxScreenAirTemp": 9.59, + "minScreenAirTemp": 9.25, + "screenDewPointTemperature": 5.16, + "feelsLikeTemperature": 6.06, + "windSpeed10m": 6.91, + "windDirectionFrom10m": 226, + "windGustSpeed10m": 12.42, + "max10mWindGust": 12.88, + "visibility": 38854, + "screenRelativeHumidity": 75.45, + "mslp": 98816, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-25T04:00Z", + "screenTemperature": 9.09, + "maxScreenAirTemp": 9.27, + "minScreenAirTemp": 9.04, + "screenDewPointTemperature": 4.8, + "feelsLikeTemperature": 5.8, + "windSpeed10m": 7.04, + "windDirectionFrom10m": 228, + "windGustSpeed10m": 12.56, + "max10mWindGust": 12.8, + "visibility": 36196, + "screenRelativeHumidity": 74.38, + "mslp": 98858, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 5 + }, + { + "time": "2024-11-25T05:00Z", + "screenTemperature": 8.82, + "maxScreenAirTemp": 9.09, + "minScreenAirTemp": 8.81, + "screenDewPointTemperature": 4.54, + "feelsLikeTemperature": 5.36, + "windSpeed10m": 7.26, + "windDirectionFrom10m": 232, + "windGustSpeed10m": 13.12, + "max10mWindGust": 14.39, + "visibility": 42056, + "screenRelativeHumidity": 74.58, + "mslp": 98910, + "uvIndex": 0, + "significantWeatherCode": 0, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T06:00Z", + "screenTemperature": 8.66, + "maxScreenAirTemp": 8.88, + "minScreenAirTemp": 8.63, + "screenDewPointTemperature": 4.28, + "feelsLikeTemperature": 5.14, + "windSpeed10m": 7.32, + "windDirectionFrom10m": 235, + "windGustSpeed10m": 13.39, + "max10mWindGust": 15.94, + "visibility": 41207, + "screenRelativeHumidity": 74.14, + "mslp": 98961, + "uvIndex": 0, + "significantWeatherCode": 0, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T07:00Z", + "screenTemperature": 8.58, + "maxScreenAirTemp": 8.69, + "minScreenAirTemp": 8.56, + "screenDewPointTemperature": 4.21, + "feelsLikeTemperature": 5.01, + "windSpeed10m": 7.44, + "windDirectionFrom10m": 240, + "windGustSpeed10m": 13.28, + "max10mWindGust": 14.8, + "visibility": 38861, + "screenRelativeHumidity": 74.26, + "mslp": 99061, + "uvIndex": 0, + "significantWeatherCode": 0, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T08:00Z", + "screenTemperature": 8.42, + "maxScreenAirTemp": 8.58, + "minScreenAirTemp": 8.42, + "screenDewPointTemperature": 3.99, + "feelsLikeTemperature": 4.84, + "windSpeed10m": 7.46, + "windDirectionFrom10m": 243, + "windGustSpeed10m": 13.21, + "max10mWindGust": 14.59, + "visibility": 36897, + "screenRelativeHumidity": 73.86, + "mslp": 99161, + "uvIndex": 0, + "significantWeatherCode": 0, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T09:00Z", + "screenTemperature": 8.4, + "maxScreenAirTemp": 8.42, + "minScreenAirTemp": 8.27, + "screenDewPointTemperature": 3.83, + "feelsLikeTemperature": 4.77, + "windSpeed10m": 7.59, + "windDirectionFrom10m": 243, + "windGustSpeed10m": 13.29, + "max10mWindGust": 13.29, + "visibility": 36152, + "screenRelativeHumidity": 73.17, + "mslp": 99252, + "uvIndex": 1, + "significantWeatherCode": 1, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T10:00Z", + "screenTemperature": 8.66, + "maxScreenAirTemp": 8.66, + "minScreenAirTemp": 8.4, + "screenDewPointTemperature": 3.94, + "feelsLikeTemperature": 4.96, + "windSpeed10m": 8, + "windDirectionFrom10m": 245, + "windGustSpeed10m": 13.83, + "max10mWindGust": 13.83, + "visibility": 36320, + "screenRelativeHumidity": 72.24, + "mslp": 99342, + "uvIndex": 1, + "significantWeatherCode": 3, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T11:00Z", + "screenTemperature": 8.83, + "maxScreenAirTemp": 8.83, + "minScreenAirTemp": 8.66, + "screenDewPointTemperature": 3.7, + "feelsLikeTemperature": 5.05, + "windSpeed10m": 8.44, + "windDirectionFrom10m": 249, + "windGustSpeed10m": 14.47, + "max10mWindGust": 14.47, + "visibility": 32194, + "screenRelativeHumidity": 69.92, + "mslp": 99424, + "uvIndex": 1, + "significantWeatherCode": 3, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 3 + }, + { + "time": "2024-11-25T12:00Z", + "screenTemperature": 8.94, + "screenDewPointTemperature": 3.65, + "feelsLikeTemperature": 5.18, + "windSpeed10m": 8.52, + "windDirectionFrom10m": 251, + "windGustSpeed10m": 14.49, + "visibility": 32255, + "screenRelativeHumidity": 68.89, + "mslp": 99488, + "uvIndex": 1, + "significantWeatherCode": 3, + "precipitationRate": 0, + "probOfPrecipitation": 2 + } + ] + } + } + ], + "parameters": [ + { + "totalSnowAmount": { + "type": "Parameter", + "description": "Total Snow Amount Over Previous Hour", + "unit": { + "label": "millimetres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "mm" + } + } + }, + "screenTemperature": { + "type": "Parameter", + "description": "Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "visibility": { + "type": "Parameter", + "description": "Visibility", + "unit": { + "label": "metres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m" + } + } + }, + "windDirectionFrom10m": { + "type": "Parameter", + "description": "10m Wind From Direction", + "unit": { + "label": "degrees", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "deg" + } + } + }, + "precipitationRate": { + "type": "Parameter", + "description": "Precipitation Rate", + "unit": { + "label": "millimetres per hour", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "mm/h" + } + } + }, + "maxScreenAirTemp": { + "type": "Parameter", + "description": "Maximum Screen Air Temperature Over Previous Hour", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "feelsLikeTemperature": { + "type": "Parameter", + "description": "Feels Like Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "screenDewPointTemperature": { + "type": "Parameter", + "description": "Screen Dew Point Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "screenRelativeHumidity": { + "type": "Parameter", + "description": "Screen Relative Humidity", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "windSpeed10m": { + "type": "Parameter", + "description": "10m Wind Speed", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "probOfPrecipitation": { + "type": "Parameter", + "description": "Probability of Precipitation", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "max10mWindGust": { + "type": "Parameter", + "description": "Maximum 10m Wind Gust Speed Over Previous Hour", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "significantWeatherCode": { + "type": "Parameter", + "description": "Significant Weather Code", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "https://datahub.metoffice.gov.uk/", + "type": "1" + } + } + }, + "minScreenAirTemp": { + "type": "Parameter", + "description": "Minimum Screen Air Temperature Over Previous Hour", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "totalPrecipAmount": { + "type": "Parameter", + "description": "Total Precipitation Amount Over Previous Hour", + "unit": { + "label": "millimetres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "mm" + } + } + }, + "mslp": { + "type": "Parameter", + "description": "Mean Sea Level Pressure", + "unit": { + "label": "pascals", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Pa" + } + } + }, + "windGustSpeed10m": { + "type": "Parameter", + "description": "10m Wind Gust Speed", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "uvIndex": { + "type": "Parameter", + "description": "UV Index", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "1" + } + } + } + } + ] + }, + "kingslynn_daily": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [0.40190000000000003, 52.7561, 5] + }, + "properties": { + "location": { + "name": "King's Lynn" }, - { - "name": "Pp", - "units": "%", - "$": "Precipitation Probability" - } - ] - }, - "DV": { - "dataDate": "2020-04-25T08:00:00Z", - "type": "Forecast", - "Location": { - "i": "354107", - "lat": "53.3986", - "lon": "-2.9256", - "name": "WAVERTREE", - "country": "ENGLAND", - "continent": "EUROPE", - "elevation": "47.0", - "Period": [ - { - "type": "Day", - "value": "2020-04-25Z", - "Rep": [ - { - "D": "SE", - "F": "7", - "G": "25", - "H": "63", - "Pp": "0", - "S": "9", - "T": "9", - "V": "VG", - "W": "0", - "U": "0", - "$": "180" - }, - { - "D": "ESE", - "F": "4", - "G": "22", - "H": "76", - "Pp": "0", - "S": "11", - "T": "7", - "V": "GO", - "W": "1", - "U": "1", - "$": "360" - }, - { - "D": "SSE", - "F": "8", - "G": "18", - "H": "70", - "Pp": "0", - "S": "9", - "T": "10", - "V": "MO", - "W": "1", - "U": "3", - "$": "540" - }, - { - "D": "SSE", - "F": "14", - "G": "16", - "H": "50", - "Pp": "0", - "S": "9", - "T": "17", - "V": "GO", - "W": "1", - "U": "5", - "$": "720" - }, - { - "D": "S", - "F": "17", - "G": "9", - "H": "43", - "Pp": "1", - "S": "4", - "T": "19", - "V": "GO", - "W": "1", - "U": "2", - "$": "900" - }, - { - "D": "WNW", - "F": "15", - "G": "13", - "H": "55", - "Pp": "2", - "S": "7", - "T": "17", - "V": "GO", - "W": "3", - "U": "1", - "$": "1080" - }, - { - "D": "NW", - "F": "14", - "G": "7", - "H": "64", - "Pp": "1", - "S": "2", - "T": "14", - "V": "GO", - "W": "2", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-26Z", - "Rep": [ - { - "D": "WSW", - "F": "13", - "G": "4", - "H": "73", - "Pp": "1", - "S": "2", - "T": "13", - "V": "GO", - "W": "2", - "U": "0", - "$": "0" - }, - { - "D": "WNW", - "F": "12", - "G": "9", - "H": "77", - "Pp": "2", - "S": "4", - "T": "12", - "V": "GO", - "W": "2", - "U": "0", - "$": "180" - }, - - { - "D": "NW", - "F": "10", - "G": "9", - "H": "82", - "Pp": "5", - "S": "4", - "T": "11", - "V": "MO", - "W": "7", - "U": "1", - "$": "360" - }, - { - "D": "WNW", - "F": "11", - "G": "7", - "H": "79", - "Pp": "5", - "S": "4", - "T": "12", - "V": "MO", - "W": "7", - "U": "3", - "$": "540" - }, - { - "D": "WNW", - "F": "10", - "G": "18", - "H": "78", - "Pp": "6", - "S": "9", - "T": "12", - "V": "MO", - "W": "7", - "U": "4", - "$": "720" - }, - { - "D": "NW", - "F": "10", - "G": "18", - "H": "71", - "Pp": "5", - "S": "9", - "T": "12", - "V": "GO", - "W": "7", - "U": "2", - "$": "900" - }, - { - "D": "NW", - "F": "9", - "G": "16", - "H": "68", - "Pp": "9", - "S": "9", - "T": "11", - "V": "VG", - "W": "7", - "U": "1", - "$": "1080" - }, - { - "D": "NW", - "F": "8", - "G": "11", - "H": "68", - "Pp": "9", - "S": "7", - "T": "10", - "V": "VG", - "W": "8", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-27Z", - "Rep": [ - { - "D": "WNW", - "F": "8", - "G": "9", - "H": "72", - "Pp": "11", - "S": "4", - "T": "9", - "V": "VG", - "W": "8", - "U": "0", - "$": "0" - }, - { - "D": "WNW", - "F": "7", - "G": "11", - "H": "77", - "Pp": "12", - "S": "7", - "T": "8", - "V": "VG", - "W": "7", - "U": "0", - "$": "180" - }, - { - "D": "NW", - "F": "7", - "G": "9", - "H": "80", - "Pp": "14", - "S": "4", - "T": "8", - "V": "GO", - "W": "7", - "U": "1", - "$": "360" - }, - { - "D": "NW", - "F": "7", - "G": "18", - "H": "73", - "Pp": "6", - "S": "9", - "T": "9", - "V": "VG", - "W": "3", - "U": "2", - "$": "540" - }, - { - "D": "NW", - "F": "8", - "G": "20", - "H": "59", - "Pp": "4", - "S": "9", - "T": "10", - "V": "VG", - "W": "3", - "U": "3", - "$": "720" - }, - { - "D": "NW", - "F": "8", - "G": "20", - "H": "58", - "Pp": "1", - "S": "9", - "T": "10", - "V": "VG", - "W": "1", - "U": "2", - "$": "900" - }, - { - "D": "NW", - "F": "8", - "G": "16", - "H": "57", - "Pp": "1", - "S": "7", - "T": "10", - "V": "VG", - "W": "1", - "U": "1", - "$": "1080" - }, - { - "D": "NW", - "F": "8", - "G": "11", - "H": "67", - "Pp": "1", - "S": "4", - "T": "9", - "V": "VG", - "W": "0", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-28Z", - "Rep": [ - { - "D": "NNW", - "F": "7", - "G": "7", - "H": "80", - "Pp": "2", - "S": "4", - "T": "8", - "V": "VG", - "W": "0", - "U": "0", - "$": "0" - }, - { - "D": "W", - "F": "6", - "G": "7", - "H": "86", - "Pp": "3", - "S": "4", - "T": "7", - "V": "GO", - "W": "0", - "U": "0", - "$": "180" - }, - { - "D": "S", - "F": "5", - "G": "9", - "H": "86", - "Pp": "5", - "S": "4", - "T": "6", - "V": "GO", - "W": "1", - "U": "1", - "$": "360" - }, - { - "D": "ENE", - "F": "7", - "G": "13", - "H": "72", - "Pp": "6", - "S": "7", - "T": "9", - "V": "GO", - "W": "3", - "U": "3", - "$": "540" - }, - { - "D": "ENE", - "F": "10", - "G": "16", - "H": "57", - "Pp": "10", - "S": "7", - "T": "11", - "V": "GO", - "W": "7", - "U": "4", - "$": "720" - }, - { - "D": "N", - "F": "11", - "G": "16", - "H": "58", - "Pp": "10", - "S": "7", - "T": "12", - "V": "GO", - "W": "7", - "U": "2", - "$": "900" - }, - { - "D": "N", - "F": "10", - "G": "16", - "H": "63", - "Pp": "10", - "S": "7", - "T": "11", - "V": "VG", - "W": "7", - "U": "1", - "$": "1080" - }, - { - "D": "NNE", - "F": "9", - "G": "11", - "H": "72", - "Pp": "9", - "S": "4", - "T": "10", - "V": "VG", - "W": "7", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-29Z", - "Rep": [ - { - "D": "E", - "F": "8", - "G": "9", - "H": "79", - "Pp": "6", - "S": "4", - "T": "9", - "V": "VG", - "W": "7", - "U": "0", - "$": "0" - }, - { - "D": "SSE", - "F": "7", - "G": "11", - "H": "81", - "Pp": "3", - "S": "7", - "T": "8", - "V": "GO", - "W": "2", - "U": "0", - "$": "180" - }, - { - "D": "SE", - "F": "5", - "G": "16", - "H": "86", - "Pp": "9", - "S": "9", - "T": "8", - "V": "GO", - "W": "7", - "U": "1", - "$": "360" - }, - { - "D": "SE", - "F": "8", - "G": "22", - "H": "74", - "Pp": "12", - "S": "11", - "T": "10", - "V": "GO", - "W": "7", - "U": "3", - "$": "540" - }, - { - "D": "SE", - "F": "10", - "G": "27", - "H": "72", - "Pp": "47", - "S": "13", - "T": "12", - "V": "GO", - "W": "12", - "U": "3", - "$": "720" - }, - { - "D": "SSE", - "F": "10", - "G": "29", - "H": "73", - "Pp": "59", - "S": "13", - "T": "13", - "V": "GO", - "W": "14", - "U": "2", - "$": "900" - }, - { - "D": "SSE", - "F": "10", - "G": "20", - "H": "69", - "Pp": "39", - "S": "11", - "T": "12", - "V": "VG", - "W": "10", - "U": "1", - "$": "1080" - }, - { - "D": "SSE", - "F": "9", - "G": "22", - "H": "79", - "Pp": "19", - "S": "13", - "T": "11", - "V": "GO", - "W": "7", - "U": "0", - "$": "1260" - } - ] + "requestPointDistance": 2720.9208, + "modelRunDate": "2024-11-23T12:00Z", + "timeSeries": [ + { + "time": "2024-11-22T00:00Z", + "midday10MWindSpeed": 6.74, + "midnight10MWindSpeed": 2.98, + "midday10MWindDirection": 288, + "midnight10MWindDirection": 188, + "midday10MWindGust": 11.32, + "midnight10MWindGust": 7.72, + "middayVisibility": 25304, + "midnightVisibility": 16924, + "middayRelativeHumidity": 68.93, + "midnightRelativeHumidity": 94.01, + "middayMslp": 100530, + "midnightMslp": 101290, + "nightSignificantWeatherCode": 7, + "dayMaxScreenTemperature": 5.24, + "nightMinScreenTemperature": -0.4, + "dayUpperBoundMaxTemp": 6.17, + "nightUpperBoundMinTemp": 1.91, + "dayLowerBoundMaxTemp": 4.13, + "nightLowerBoundMinTemp": -1.1, + "nightMinFeelsLikeTemp": -4.12, + "dayUpperBoundMaxFeelsLikeTemp": 2.08, + "nightUpperBoundMinFeelsLikeTemp": -1.75, + "dayLowerBoundMaxFeelsLikeTemp": 0.48, + "nightLowerBoundMinFeelsLikeTemp": -4.12, + "nightProbabilityOfPrecipitation": 89, + "nightProbabilityOfSnow": 6, + "nightProbabilityOfHeavySnow": 2, + "nightProbabilityOfRain": 86, + "nightProbabilityOfHeavyRain": 84, + "nightProbabilityOfHail": 18, + "nightProbabilityOfSferics": 9 + }, + { + "time": "2024-11-23T00:00Z", + "midday10MWindSpeed": 9.93, + "midnight10MWindSpeed": 8.72, + "midday10MWindDirection": 180, + "midnight10MWindDirection": 199, + "midday10MWindGust": 18, + "midnight10MWindGust": 16.6, + "middayVisibility": 7478, + "midnightVisibility": 42290, + "middayRelativeHumidity": 97.5, + "midnightRelativeHumidity": 90.27, + "middayMslp": 99820, + "midnightMslp": 99340, + "maxUvIndex": 1, + "daySignificantWeatherCode": 15, + "nightSignificantWeatherCode": 12, + "dayMaxScreenTemperature": 10.16, + "nightMinScreenTemperature": 9.3, + "dayUpperBoundMaxTemp": 13, + "nightUpperBoundMinTemp": 13.01, + "dayLowerBoundMaxTemp": 9.51, + "nightLowerBoundMinTemp": 9.3, + "dayMaxFeelsLikeTemp": 5.14, + "nightMinFeelsLikeTemp": 6.38, + "dayUpperBoundMaxFeelsLikeTemp": 9.42, + "nightUpperBoundMinFeelsLikeTemp": 9.42, + "dayLowerBoundMaxFeelsLikeTemp": 5.14, + "nightLowerBoundMinFeelsLikeTemp": 6.38, + "dayProbabilityOfPrecipitation": 97, + "nightProbabilityOfPrecipitation": 95, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 97, + "nightProbabilityOfRain": 95, + "dayProbabilityOfHeavyRain": 96, + "nightProbabilityOfHeavyRain": 93, + "dayProbabilityOfHail": 19, + "nightProbabilityOfHail": 19, + "dayProbabilityOfSferics": 10, + "nightProbabilityOfSferics": 11 + }, + { + "time": "2024-11-24T00:00Z", + "midday10MWindSpeed": 10.03, + "midnight10MWindSpeed": 6.3, + "midday10MWindDirection": 200, + "midnight10MWindDirection": 214, + "midday10MWindGust": 19, + "midnight10MWindGust": 12.27, + "middayVisibility": 19911, + "midnightVisibility": 44678, + "middayRelativeHumidity": 82.47, + "midnightRelativeHumidity": 84.49, + "middayMslp": 99220, + "midnightMslp": 99277, + "maxUvIndex": 1, + "daySignificantWeatherCode": 12, + "nightSignificantWeatherCode": 12, + "dayMaxScreenTemperature": 15.66, + "nightMinScreenTemperature": 9.75, + "dayUpperBoundMaxTemp": 16.88, + "nightUpperBoundMinTemp": 10.72, + "dayLowerBoundMaxTemp": 13.97, + "nightLowerBoundMinTemp": 8.25, + "dayMaxFeelsLikeTemp": 11.45, + "nightMinFeelsLikeTemp": 7.13, + "dayUpperBoundMaxFeelsLikeTemp": 12.2, + "nightUpperBoundMinFeelsLikeTemp": 8, + "dayLowerBoundMaxFeelsLikeTemp": 10.46, + "nightLowerBoundMinFeelsLikeTemp": 5.07, + "dayProbabilityOfPrecipitation": 81, + "nightProbabilityOfPrecipitation": 86, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 81, + "nightProbabilityOfRain": 86, + "dayProbabilityOfHeavyRain": 78, + "nightProbabilityOfHeavyRain": 82, + "dayProbabilityOfHail": 15, + "nightProbabilityOfHail": 16, + "dayProbabilityOfSferics": 8, + "nightProbabilityOfSferics": 8 + }, + { + "time": "2024-11-25T00:00Z", + "midday10MWindSpeed": 6.91, + "midnight10MWindSpeed": 5.14, + "midday10MWindDirection": 233, + "midnight10MWindDirection": 228, + "midday10MWindGust": 12.61, + "midnight10MWindGust": 9.33, + "middayVisibility": 38960, + "midnightVisibility": 39029, + "middayRelativeHumidity": 70.02, + "midnightRelativeHumidity": 84, + "middayMslp": 99715, + "midnightMslp": 100666, + "maxUvIndex": 1, + "daySignificantWeatherCode": 1, + "nightSignificantWeatherCode": 0, + "dayMaxScreenTemperature": 10.94, + "nightMinScreenTemperature": 4.7, + "dayUpperBoundMaxTemp": 11.7, + "nightUpperBoundMinTemp": 7.14, + "dayLowerBoundMaxTemp": 9.36, + "nightLowerBoundMinTemp": 2.09, + "dayMaxFeelsLikeTemp": 7.72, + "nightMinFeelsLikeTemp": 1.4, + "dayUpperBoundMaxFeelsLikeTemp": 8.79, + "nightUpperBoundMinFeelsLikeTemp": 3.27, + "dayLowerBoundMaxFeelsLikeTemp": 6.22, + "nightLowerBoundMinFeelsLikeTemp": -0.99, + "dayProbabilityOfPrecipitation": 3, + "nightProbabilityOfPrecipitation": 4, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 3, + "nightProbabilityOfRain": 4, + "dayProbabilityOfHeavyRain": 1, + "nightProbabilityOfHeavyRain": 2, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 0, + "dayProbabilityOfSferics": 0, + "nightProbabilityOfSferics": 0 + }, + { + "time": "2024-11-26T00:00Z", + "midday10MWindSpeed": 4.33, + "midnight10MWindSpeed": 2.83, + "midday10MWindDirection": 241, + "midnight10MWindDirection": 179, + "midday10MWindGust": 8.23, + "midnight10MWindGust": 4.92, + "middayVisibility": 40528, + "midnightVisibility": 14079, + "middayRelativeHumidity": 77.2, + "midnightRelativeHumidity": 94.47, + "middayMslp": 101355, + "midnightMslp": 101517, + "maxUvIndex": 1, + "daySignificantWeatherCode": 1, + "nightSignificantWeatherCode": 9, + "dayMaxScreenTemperature": 7.93, + "nightMinScreenTemperature": 2.68, + "dayUpperBoundMaxTemp": 10.02, + "nightUpperBoundMinTemp": 9.62, + "dayLowerBoundMaxTemp": 6.28, + "nightLowerBoundMinTemp": -1.11, + "dayMaxFeelsLikeTemp": 5.22, + "nightMinFeelsLikeTemp": 1.74, + "dayUpperBoundMaxFeelsLikeTemp": 7.33, + "nightUpperBoundMinFeelsLikeTemp": 5.97, + "dayLowerBoundMaxFeelsLikeTemp": 4.13, + "nightLowerBoundMinFeelsLikeTemp": -3.64, + "dayProbabilityOfPrecipitation": 3, + "nightProbabilityOfPrecipitation": 52, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 1, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 3, + "nightProbabilityOfRain": 52, + "dayProbabilityOfHeavyRain": 2, + "nightProbabilityOfHeavyRain": 48, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 10, + "dayProbabilityOfSferics": 0, + "nightProbabilityOfSferics": 9 + }, + { + "time": "2024-11-27T00:00Z", + "midday10MWindSpeed": 7.99, + "midnight10MWindSpeed": 5.7, + "midday10MWindDirection": 280, + "midnight10MWindDirection": 304, + "midday10MWindGust": 14.53, + "midnight10MWindGust": 9.97, + "middayVisibility": 12470, + "midnightVisibility": 31017, + "middayRelativeHumidity": 89.2, + "midnightRelativeHumidity": 86.45, + "middayMslp": 100836, + "midnightMslp": 101855, + "maxUvIndex": 1, + "daySignificantWeatherCode": 10, + "nightSignificantWeatherCode": 0, + "dayMaxScreenTemperature": 8.41, + "nightMinScreenTemperature": 4.04, + "dayUpperBoundMaxTemp": 12.97, + "nightUpperBoundMinTemp": 8.08, + "dayLowerBoundMaxTemp": 4.19, + "nightLowerBoundMinTemp": -1.57, + "dayMaxFeelsLikeTemp": 4.11, + "nightMinFeelsLikeTemp": 1.3, + "dayUpperBoundMaxFeelsLikeTemp": 10.56, + "nightUpperBoundMinFeelsLikeTemp": 5.08, + "dayLowerBoundMaxFeelsLikeTemp": 1.68, + "nightLowerBoundMinFeelsLikeTemp": -4.13, + "dayProbabilityOfPrecipitation": 49, + "nightProbabilityOfPrecipitation": 37, + "dayProbabilityOfSnow": 0, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 49, + "nightProbabilityOfRain": 37, + "dayProbabilityOfHeavyRain": 45, + "nightProbabilityOfHeavyRain": 24, + "dayProbabilityOfHail": 9, + "nightProbabilityOfHail": 2, + "dayProbabilityOfSferics": 9, + "nightProbabilityOfSferics": 4 + }, + { + "time": "2024-11-28T00:00Z", + "midday10MWindSpeed": 3.52, + "midnight10MWindSpeed": 3.01, + "midday10MWindDirection": 314, + "midnight10MWindDirection": 98, + "midday10MWindGust": 6.7, + "midnight10MWindGust": 5.08, + "middayVisibility": 38659, + "midnightVisibility": 12067, + "middayRelativeHumidity": 80.63, + "midnightRelativeHumidity": 92.04, + "middayMslp": 102495, + "midnightMslp": 102655, + "maxUvIndex": 1, + "daySignificantWeatherCode": 7, + "nightSignificantWeatherCode": 7, + "dayMaxScreenTemperature": 7.26, + "nightMinScreenTemperature": 2.84, + "dayUpperBoundMaxTemp": 10.28, + "nightUpperBoundMinTemp": 7.53, + "dayLowerBoundMaxTemp": 4.63, + "nightLowerBoundMinTemp": -1.27, + "dayMaxFeelsLikeTemp": 5.08, + "nightMinFeelsLikeTemp": 1.66, + "dayUpperBoundMaxFeelsLikeTemp": 7.29, + "nightUpperBoundMinFeelsLikeTemp": 4.94, + "dayLowerBoundMaxFeelsLikeTemp": 1.7, + "nightLowerBoundMinFeelsLikeTemp": -3.19, + "dayProbabilityOfPrecipitation": 7, + "nightProbabilityOfPrecipitation": 8, + "dayProbabilityOfSnow": 1, + "nightProbabilityOfSnow": 1, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 7, + "nightProbabilityOfRain": 7, + "dayProbabilityOfHeavyRain": 2, + "nightProbabilityOfHeavyRain": 2, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 0, + "dayProbabilityOfSferics": 0, + "nightProbabilityOfSferics": 0 + }, + { + "time": "2024-11-29T00:00Z", + "midday10MWindSpeed": 4.61, + "midnight10MWindSpeed": 4.68, + "midday10MWindDirection": 143, + "midnight10MWindDirection": 160, + "midday10MWindGust": 8.48, + "midnight10MWindGust": 8.27, + "middayVisibility": 28001, + "midnightVisibility": 32845, + "middayRelativeHumidity": 83.1, + "midnightRelativeHumidity": 90.51, + "middayMslp": 102395, + "midnightMslp": 102078, + "maxUvIndex": 1, + "daySignificantWeatherCode": 7, + "nightSignificantWeatherCode": 8, + "dayMaxScreenTemperature": 8.34, + "nightMinScreenTemperature": 5.65, + "dayUpperBoundMaxTemp": 13.38, + "nightUpperBoundMinTemp": 11.7, + "dayLowerBoundMaxTemp": 4.49, + "nightLowerBoundMinTemp": -1.92, + "dayMaxFeelsLikeTemp": 5.77, + "nightMinFeelsLikeTemp": 3.8, + "dayUpperBoundMaxFeelsLikeTemp": 11.34, + "nightUpperBoundMinFeelsLikeTemp": 9.44, + "dayLowerBoundMaxFeelsLikeTemp": 2.35, + "nightLowerBoundMinFeelsLikeTemp": -4.87, + "dayProbabilityOfPrecipitation": 8, + "nightProbabilityOfPrecipitation": 12, + "dayProbabilityOfSnow": 1, + "nightProbabilityOfSnow": 0, + "dayProbabilityOfHeavySnow": 0, + "nightProbabilityOfHeavySnow": 0, + "dayProbabilityOfRain": 8, + "nightProbabilityOfRain": 12, + "dayProbabilityOfHeavyRain": 3, + "nightProbabilityOfHeavyRain": 2, + "dayProbabilityOfHail": 0, + "nightProbabilityOfHail": 0, + "dayProbabilityOfSferics": 0, + "nightProbabilityOfSferics": 0 + } + ] + } + } + ], + "parameters": [ + { + "daySignificantWeatherCode": { + "type": "Parameter", + "description": "Day Significant Weather Code", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "https://datahub.metoffice.gov.uk/", + "type": "1" + } + } + }, + "midnightRelativeHumidity": { + "type": "Parameter", + "description": "Relative Humidity at Local Midnight", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightProbabilityOfHeavyRain": { + "type": "Parameter", + "description": "Probability of Heavy Rain During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "midnight10MWindSpeed": { + "type": "Parameter", + "description": "10m Wind Speed at Local Midnight", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "nightUpperBoundMinFeelsLikeTemp": { + "type": "Parameter", + "description": "Upper Bound on Night Minimum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightUpperBoundMinTemp": { + "type": "Parameter", + "description": "Upper Bound on Night Minimum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "midnightVisibility": { + "type": "Parameter", + "description": "Visibility at Local Midnight", + "unit": { + "label": "metres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m" + } + } + }, + "dayUpperBoundMaxFeelsLikeTemp": { + "type": "Parameter", + "description": "Upper Bound on Day Maximum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfRain": { + "type": "Parameter", + "description": "Probability of Rain During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "midday10MWindDirection": { + "type": "Parameter", + "description": "10m Wind Direction at Local Midday", + "unit": { + "label": "degrees", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "deg" + } + } + }, + "nightLowerBoundMinFeelsLikeTemp": { + "type": "Parameter", + "description": "Lower Bound on Night Minimum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfHail": { + "type": "Parameter", + "description": "Probability of Hail During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "middayMslp": { + "type": "Parameter", + "description": "Mean Sea Level Pressure at Local Midday", + "unit": { + "label": "pascals", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Pa" + } + } + }, + "dayProbabilityOfHeavySnow": { + "type": "Parameter", + "description": "Probability of Heavy Snow During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightProbabilityOfPrecipitation": { + "type": "Parameter", + "description": "Probability of Precipitation During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayProbabilityOfHail": { + "type": "Parameter", + "description": "Probability of Hail During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayProbabilityOfRain": { + "type": "Parameter", + "description": "Probability of Rain During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "midday10MWindSpeed": { + "type": "Parameter", + "description": "10m Wind Speed at Local Midday", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "midday10MWindGust": { + "type": "Parameter", + "description": "10m Wind Gust Speed at Local Midday", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "middayVisibility": { + "type": "Parameter", + "description": "Visibility at Local Midday", + "unit": { + "label": "metres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m" + } + } + }, + "midnight10MWindGust": { + "type": "Parameter", + "description": "10m Wind Gust Speed at Local Midnight", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "midnightMslp": { + "type": "Parameter", + "description": "Mean Sea Level Pressure at Local Midnight", + "unit": { + "label": "pascals", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Pa" + } + } + }, + "dayProbabilityOfSferics": { + "type": "Parameter", + "description": "Probability of Sferics During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" } - ] - } - } - } - }, - "wavertree_daily": { - "SiteRep": { - "Wx": { - "Param": [ - { - "name": "FDm", - "units": "C", - "$": "Feels Like Day Maximum Temperature" - }, - { - "name": "FNm", - "units": "C", - "$": "Feels Like Night Minimum Temperature" - }, - { - "name": "Dm", - "units": "C", - "$": "Day Maximum Temperature" - }, - { - "name": "Nm", - "units": "C", - "$": "Night Minimum Temperature" - }, - { - "name": "Gn", - "units": "mph", - "$": "Wind Gust Noon" - }, - { - "name": "Gm", - "units": "mph", - "$": "Wind Gust Midnight" - }, - { - "name": "Hn", - "units": "%", - "$": "Screen Relative Humidity Noon" - }, - { - "name": "Hm", - "units": "%", - "$": "Screen Relative Humidity Midnight" - }, - { - "name": "V", - "units": "", - "$": "Visibility" - }, - { - "name": "D", - "units": "compass", - "$": "Wind Direction" - }, - { - "name": "S", - "units": "mph", - "$": "Wind Speed" - }, - { - "name": "U", - "units": "", - "$": "Max UV Index" - }, - { - "name": "W", - "units": "", - "$": "Weather Type" - }, - { - "name": "PPd", - "units": "%", - "$": "Precipitation Probability Day" - }, - { - "name": "PPn", - "units": "%", - "$": "Precipitation Probability Night" - } - ] - }, - "DV": { - "dataDate": "2020-04-25T08:00:00Z", - "type": "Forecast", - "Location": { - "i": "354107", - "lat": "53.3986", - "lon": "-2.9256", - "name": "WAVERTREE", - "country": "ENGLAND", - "continent": "EUROPE", - "elevation": "47.0", - "Period": [ - { - "type": "Day", - "value": "2020-04-25Z", - "Rep": [ - { - "D": "SSE", - "Gn": "16", - "Hn": "50", - "PPd": "2", - "S": "9", - "V": "GO", - "Dm": "19", - "FDm": "18", - "W": "1", - "U": "5", - "$": "Day" - }, - { - "D": "WSW", - "Gm": "4", - "Hm": "73", - "PPn": "2", - "S": "2", - "V": "GO", - "Nm": "11", - "FNm": "11", - "W": "2", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-26Z", - "Rep": [ - { - "D": "WNW", - "Gn": "18", - "Hn": "78", - "PPd": "9", - "S": "9", - "V": "MO", - "Dm": "13", - "FDm": "11", - "W": "7", - "U": "4", - "$": "Day" - }, - { - "D": "WNW", - "Gm": "9", - "Hm": "72", - "PPn": "12", - "S": "4", - "V": "VG", - "Nm": "8", - "FNm": "7", - "W": "8", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-27Z", - "Rep": [ - { - "D": "NW", - "Gn": "20", - "Hn": "59", - "PPd": "14", - "S": "9", - "V": "VG", - "Dm": "11", - "FDm": "8", - "W": "3", - "U": "3", - "$": "Day" - }, - { - "D": "NNW", - "Gm": "7", - "Hm": "80", - "PPn": "3", - "S": "4", - "V": "VG", - "Nm": "6", - "FNm": "5", - "W": "0", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-28Z", - "Rep": [ - { - "D": "ENE", - "Gn": "16", - "Hn": "57", - "PPd": "10", - "S": "7", - "V": "GO", - "Dm": "12", - "FDm": "11", - "W": "7", - "U": "4", - "$": "Day" - }, - { - "D": "E", - "Gm": "9", - "Hm": "79", - "PPn": "9", - "S": "4", - "V": "VG", - "Nm": "7", - "FNm": "6", - "W": "7", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-29Z", - "Rep": [ - { - "D": "SE", - "Gn": "27", - "Hn": "72", - "PPd": "59", - "S": "13", - "V": "GO", - "Dm": "13", - "FDm": "10", - "W": "12", - "U": "3", - "$": "Day" - }, - { - "D": "SSE", - "Gm": "18", - "Hm": "85", - "PPn": "19", - "S": "11", - "V": "VG", - "Nm": "8", - "FNm": "6", - "W": "7", - "$": "Night" - } - ] + } + }, + "nightSignificantWeatherCode": { + "type": "Parameter", + "description": "Night Significant Weather Code", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "https://datahub.metoffice.gov.uk/", + "type": "1" } - ] + } + }, + "dayProbabilityOfPrecipitation": { + "type": "Parameter", + "description": "Probability of Precipitation During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayProbabilityOfHeavyRain": { + "type": "Parameter", + "description": "Probability of Heavy Rain During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayMaxScreenTemperature": { + "type": "Parameter", + "description": "Day Maximum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightMinScreenTemperature": { + "type": "Parameter", + "description": "Night Minimum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "midnight10MWindDirection": { + "type": "Parameter", + "description": "10m Wind Direction at Local Midnight", + "unit": { + "label": "degrees", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "deg" + } + } + }, + "maxUvIndex": { + "type": "Parameter", + "description": "Day Maximum UV Index", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "1" + } + } + }, + "dayProbabilityOfSnow": { + "type": "Parameter", + "description": "Probability of Snow During The Day", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightProbabilityOfSnow": { + "type": "Parameter", + "description": "Probability of Snow During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayLowerBoundMaxTemp": { + "type": "Parameter", + "description": "Lower Bound on Day Maximum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfHeavySnow": { + "type": "Parameter", + "description": "Probability of Heavy Snow During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "dayLowerBoundMaxFeelsLikeTemp": { + "type": "Parameter", + "description": "Lower Bound on Day Maximum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "dayUpperBoundMaxTemp": { + "type": "Parameter", + "description": "Upper Bound on Day Maximum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "dayMaxFeelsLikeTemp": { + "type": "Parameter", + "description": "Day Maximum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "middayRelativeHumidity": { + "type": "Parameter", + "description": "Relative Humidity at Local Midday", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "nightLowerBoundMinTemp": { + "type": "Parameter", + "description": "Lower Bound on Night Minimum Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightMinFeelsLikeTemp": { + "type": "Parameter", + "description": "Night Minimum Feels Like Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "nightProbabilityOfSferics": { + "type": "Parameter", + "description": "Probability of Sferics During The Night", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } } } - } + ] }, "kingslynn_hourly": { - "SiteRep": { - "Wx": { - "Param": [ - { - "name": "F", - "units": "C", - "$": "Feels Like Temperature" - }, - { - "name": "G", - "units": "mph", - "$": "Wind Gust" - }, - { - "name": "H", - "units": "%", - "$": "Screen Relative Humidity" - }, - { - "name": "T", - "units": "C", - "$": "Temperature" - }, - { - "name": "V", - "units": "", - "$": "Visibility" - }, - { - "name": "D", - "units": "compass", - "$": "Wind Direction" - }, - { - "name": "S", - "units": "mph", - "$": "Wind Speed" - }, - { - "name": "U", - "units": "", - "$": "Max UV Index" - }, - { - "name": "W", - "units": "", - "$": "Weather Type" + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [0.40190000000000003, 52.7561, 5] + }, + "properties": { + "location": { + "name": "King's Lynn" }, - { - "name": "Pp", - "units": "%", - "$": "Precipitation Probability" - } - ] - }, - "DV": { - "dataDate": "2020-04-25T08:00:00Z", - "type": "Forecast", - "Location": { - "i": "322380", - "lat": "52.7561", - "lon": "0.4019", - "name": "KING'S LYNN", - "country": "ENGLAND", - "continent": "EUROPE", - "elevation": "5.0", - "Period": [ - { - "type": "Day", - "value": "2020-04-25Z", - "Rep": [ - { - "D": "SSE", - "F": "4", - "G": "9", - "H": "88", - "Pp": "7", - "S": "9", - "T": "7", - "V": "GO", - "W": "8", - "U": "0", - "$": "180" - }, - { - "D": "ESE", - "F": "5", - "G": "7", - "H": "86", - "Pp": "9", - "S": "4", - "T": "7", - "V": "GO", - "W": "8", - "U": "1", - "$": "360" - }, - { - "D": "ESE", - "F": "8", - "G": "4", - "H": "75", - "Pp": "9", - "S": "4", - "T": "9", - "V": "VG", - "W": "8", - "U": "3", - "$": "540" - }, - { - "D": "E", - "F": "13", - "G": "7", - "H": "60", - "Pp": "0", - "S": "2", - "T": "14", - "V": "VG", - "W": "1", - "U": "6", - "$": "720" - }, - { - "D": "NNW", - "F": "14", - "G": "9", - "H": "57", - "Pp": "0", - "S": "4", - "T": "15", - "V": "VG", - "W": "1", - "U": "3", - "$": "900" - }, - { - "D": "ENE", - "F": "14", - "G": "9", - "H": "58", - "Pp": "0", - "S": "4", - "T": "14", - "V": "VG", - "W": "1", - "U": "1", - "$": "1080" - }, - { - "D": "SE", - "F": "8", - "G": "18", - "H": "76", - "Pp": "0", - "S": "9", - "T": "10", - "V": "VG", - "W": "0", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-26Z", - "Rep": [ - { - "D": "SSE", - "F": "5", - "G": "16", - "H": "84", - "Pp": "0", - "S": "7", - "T": "7", - "V": "VG", - "W": "0", - "U": "0", - "$": "0" - }, - { - "D": "S", - "F": "4", - "G": "16", - "H": "89", - "Pp": "0", - "S": "7", - "T": "6", - "V": "GO", - "W": "0", - "U": "0", - "$": "180" - }, - { - "D": "S", - "F": "4", - "G": "16", - "H": "87", - "Pp": "0", - "S": "7", - "T": "7", - "V": "GO", - "W": "1", - "U": "1", - "$": "360" - }, - { - "D": "SSW", - "F": "11", - "G": "13", - "H": "69", - "Pp": "0", - "S": "9", - "T": "13", - "V": "VG", - "W": "1", - "U": "4", - "$": "540" - }, - { - "D": "SW", - "F": "15", - "G": "18", - "H": "50", - "Pp": "8", - "S": "9", - "T": "17", - "V": "VG", - "W": "1", - "U": "5", - "$": "720" - }, - { - "D": "SW", - "F": "16", - "G": "16", - "H": "47", - "Pp": "8", - "S": "7", - "T": "18", - "V": "VG", - "W": "7", - "U": "2", - "$": "900" - }, - { - "D": "SW", - "F": "15", - "G": "13", - "H": "56", - "Pp": "3", - "S": "7", - "T": "17", - "V": "VG", - "W": "3", - "U": "1", - "$": "1080" - }, - { - "D": "SW", - "F": "13", - "G": "11", - "H": "76", - "Pp": "4", - "S": "4", - "T": "13", - "V": "VG", - "W": "7", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-27Z", - "Rep": [ - { - "D": "SSW", - "F": "10", - "G": "13", - "H": "75", - "Pp": "5", - "S": "7", - "T": "11", - "V": "GO", - "W": "7", - "U": "0", - "$": "0" - }, - { - "D": "W", - "F": "9", - "G": "13", - "H": "84", - "Pp": "9", - "S": "7", - "T": "10", - "V": "GO", - "W": "7", - "U": "0", - "$": "180" - }, - { - "D": "NW", - "F": "7", - "G": "16", - "H": "85", - "Pp": "50", - "S": "9", - "T": "9", - "V": "GO", - "W": "12", - "U": "1", - "$": "360" - }, - { - "D": "NW", - "F": "9", - "G": "11", - "H": "78", - "Pp": "36", - "S": "4", - "T": "10", - "V": "VG", - "W": "7", - "U": "3", - "$": "540" - }, - { - "D": "WNW", - "F": "11", - "G": "11", - "H": "66", - "Pp": "9", - "S": "4", - "T": "12", - "V": "VG", - "W": "7", - "U": "4", - "$": "720" - }, - { - "D": "W", - "F": "11", - "G": "13", - "H": "62", - "Pp": "9", - "S": "7", - "T": "13", - "V": "VG", - "W": "7", - "U": "2", - "$": "900" - }, - { - "D": "E", - "F": "11", - "G": "11", - "H": "64", - "Pp": "10", - "S": "7", - "T": "12", - "V": "VG", - "W": "7", - "U": "1", - "$": "1080" - }, - { - "D": "SE", - "F": "9", - "G": "13", - "H": "78", - "Pp": "9", - "S": "7", - "T": "10", - "V": "VG", - "W": "7", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-28Z", - "Rep": [ - { - "D": "SE", - "F": "7", - "G": "13", - "H": "85", - "Pp": "9", - "S": "7", - "T": "9", - "V": "VG", - "W": "7", - "U": "0", - "$": "0" - }, - { - "D": "E", - "F": "7", - "G": "9", - "H": "91", - "Pp": "11", - "S": "4", - "T": "8", - "V": "GO", - "W": "7", - "U": "0", - "$": "180" - }, - { - "D": "ESE", - "F": "7", - "G": "9", - "H": "92", - "Pp": "12", - "S": "4", - "T": "8", - "V": "GO", - "W": "7", - "U": "1", - "$": "360" - }, - { - "D": "ESE", - "F": "9", - "G": "13", - "H": "77", - "Pp": "14", - "S": "7", - "T": "11", - "V": "GO", - "W": "7", - "U": "3", - "$": "540" - }, - { - "D": "ESE", - "F": "12", - "G": "16", - "H": "64", - "Pp": "14", - "S": "7", - "T": "13", - "V": "GO", - "W": "7", - "U": "3", - "$": "720" - }, - { - "D": "ESE", - "F": "12", - "G": "18", - "H": "66", - "Pp": "15", - "S": "9", - "T": "13", - "V": "GO", - "W": "7", - "U": "2", - "$": "900" - }, - { - "D": "SSE", - "F": "11", - "G": "13", - "H": "73", - "Pp": "15", - "S": "7", - "T": "12", - "V": "GO", - "W": "7", - "U": "1", - "$": "1080" - }, - { - "D": "SE", - "F": "9", - "G": "13", - "H": "81", - "Pp": "13", - "S": "7", - "T": "10", - "V": "GO", - "W": "7", - "U": "0", - "$": "1260" - } - ] - }, - { - "type": "Day", - "value": "2020-04-29Z", - "Rep": [ - { - "D": "SSE", - "F": "7", - "G": "13", - "H": "87", - "Pp": "11", - "S": "7", - "T": "9", - "V": "GO", - "W": "7", - "U": "0", - "$": "0" - }, - { - "D": "SSE", - "F": "7", - "G": "13", - "H": "91", - "Pp": "15", - "S": "7", - "T": "9", - "V": "GO", - "W": "8", - "U": "0", - "$": "180" - }, - { - "D": "ESE", - "F": "7", - "G": "13", - "H": "89", - "Pp": "8", - "S": "7", - "T": "9", - "V": "GO", - "W": "7", - "U": "1", - "$": "360" - }, - { - "D": "SSE", - "F": "10", - "G": "20", - "H": "75", - "Pp": "8", - "S": "11", - "T": "12", - "V": "VG", - "W": "7", - "U": "3", - "$": "540" - }, - { - "D": "S", - "F": "12", - "G": "22", - "H": "68", - "Pp": "11", - "S": "11", - "T": "14", - "V": "GO", - "W": "7", - "U": "3", - "$": "720" - }, - { - "D": "S", - "F": "12", - "G": "27", - "H": "68", - "Pp": "55", - "S": "13", - "T": "14", - "V": "GO", - "W": "12", - "U": "1", - "$": "900" - }, - { - "D": "SSE", - "F": "11", - "G": "22", - "H": "76", - "Pp": "34", - "S": "11", - "T": "13", - "V": "VG", - "W": "10", - "U": "1", - "$": "1080" - }, - { - "D": "SSE", - "F": "9", - "G": "20", - "H": "86", - "Pp": "20", - "S": "11", - "T": "11", - "V": "VG", - "W": "7", - "U": "0", - "$": "1260" - } - ] + "requestPointDistance": 2720.9208, + "modelRunDate": "2024-11-23T12:00Z", + "timeSeries": [ + { + "time": "2024-11-23T12:00Z", + "screenTemperature": 7.87, + "maxScreenAirTemp": 7.87, + "minScreenAirTemp": 7.48, + "screenDewPointTemperature": 7.51, + "feelsLikeTemperature": 3.39, + "windSpeed10m": 9.93, + "windDirectionFrom10m": 180, + "windGustSpeed10m": 18, + "max10mWindGust": 18.11, + "visibility": 7478, + "screenRelativeHumidity": 97.5, + "mslp": 99820, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.75, + "totalPrecipAmount": 0.84, + "totalSnowAmount": 0, + "probOfPrecipitation": 67 + }, + { + "time": "2024-11-23T13:00Z", + "screenTemperature": 7.87, + "maxScreenAirTemp": 7.9, + "minScreenAirTemp": 7.84, + "screenDewPointTemperature": 7.1, + "feelsLikeTemperature": 3.25, + "windSpeed10m": 10.52, + "windDirectionFrom10m": 178, + "windGustSpeed10m": 19.06, + "max10mWindGust": 19.16, + "visibility": 8196, + "screenRelativeHumidity": 94.78, + "mslp": 99680, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.86, + "totalPrecipAmount": 0.29, + "totalSnowAmount": 0, + "probOfPrecipitation": 57 + }, + { + "time": "2024-11-23T14:00Z", + "screenTemperature": 8.34, + "maxScreenAirTemp": 8.34, + "minScreenAirTemp": 7.87, + "screenDewPointTemperature": 7.32, + "feelsLikeTemperature": 4, + "windSpeed10m": 10, + "windDirectionFrom10m": 182, + "windGustSpeed10m": 18.66, + "max10mWindGust": 18.98, + "visibility": 9417, + "screenRelativeHumidity": 93.17, + "mslp": 99550, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.23, + "totalPrecipAmount": 0.06, + "totalSnowAmount": 0, + "probOfPrecipitation": 62 + }, + { + "time": "2024-11-23T15:00Z", + "screenTemperature": 9.11, + "maxScreenAirTemp": 9.13, + "minScreenAirTemp": 8.34, + "screenDewPointTemperature": 8.03, + "feelsLikeTemperature": 5.14, + "windSpeed10m": 9.45, + "windDirectionFrom10m": 183, + "windGustSpeed10m": 17.94, + "max10mWindGust": 18.36, + "visibility": 8865, + "screenRelativeHumidity": 92.81, + "mslp": 99406, + "uvIndex": 1, + "significantWeatherCode": 15, + "precipitationRate": 1.87, + "totalPrecipAmount": 0.48, + "totalSnowAmount": 0, + "probOfPrecipitation": 93 + }, + { + "time": "2024-11-23T16:00Z", + "screenTemperature": 10.16, + "maxScreenAirTemp": 10.17, + "minScreenAirTemp": 9.11, + "screenDewPointTemperature": 9.02, + "feelsLikeTemperature": 6.38, + "windSpeed10m": 9.8, + "windDirectionFrom10m": 186, + "windGustSpeed10m": 18.67, + "max10mWindGust": 19.04, + "visibility": 16945, + "screenRelativeHumidity": 92.66, + "mslp": 99301, + "uvIndex": 0, + "significantWeatherCode": 15, + "precipitationRate": 4.03, + "totalPrecipAmount": 1.14, + "totalSnowAmount": 0, + "probOfPrecipitation": 95 + }, + { + "time": "2024-11-23T17:00Z", + "screenTemperature": 11.07, + "maxScreenAirTemp": 11.08, + "minScreenAirTemp": 10.16, + "screenDewPointTemperature": 9.94, + "feelsLikeTemperature": 7.46, + "windSpeed10m": 9.41, + "windDirectionFrom10m": 193, + "windGustSpeed10m": 18.09, + "max10mWindGust": 18.86, + "visibility": 9798, + "screenRelativeHumidity": 92.69, + "mslp": 99270, + "uvIndex": 0, + "significantWeatherCode": 15, + "precipitationRate": 2.26, + "totalPrecipAmount": 0.24, + "totalSnowAmount": 0, + "probOfPrecipitation": 93 + }, + { + "time": "2024-11-23T18:00Z", + "screenTemperature": 11.94, + "maxScreenAirTemp": 11.95, + "minScreenAirTemp": 11.07, + "screenDewPointTemperature": 10.9, + "feelsLikeTemperature": 8.72, + "windSpeed10m": 8.19, + "windDirectionFrom10m": 200, + "windGustSpeed10m": 16.15, + "max10mWindGust": 17.4, + "visibility": 10545, + "screenRelativeHumidity": 93.31, + "mslp": 99260, + "uvIndex": 0, + "significantWeatherCode": 15, + "precipitationRate": 2.51, + "totalPrecipAmount": 0.88, + "totalSnowAmount": 0, + "probOfPrecipitation": 93 + }, + { + "time": "2024-11-23T19:00Z", + "screenTemperature": 13.3, + "maxScreenAirTemp": 13.31, + "minScreenAirTemp": 11.94, + "screenDewPointTemperature": 11.95, + "feelsLikeTemperature": 10.09, + "windSpeed10m": 8.35, + "windDirectionFrom10m": 208, + "windGustSpeed10m": 16.37, + "max10mWindGust": 16.41, + "visibility": 36868, + "screenRelativeHumidity": 91.45, + "mslp": 99264, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 11 + }, + { + "time": "2024-11-23T20:00Z", + "screenTemperature": 13.56, + "maxScreenAirTemp": 13.58, + "minScreenAirTemp": 13.3, + "screenDewPointTemperature": 12.29, + "feelsLikeTemperature": 10.34, + "windSpeed10m": 8.42, + "windDirectionFrom10m": 205, + "windGustSpeed10m": 16.18, + "max10mWindGust": 16.75, + "visibility": 28041, + "screenRelativeHumidity": 91.94, + "mslp": 99304, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 27 + }, + { + "time": "2024-11-23T21:00Z", + "screenTemperature": 13.81, + "maxScreenAirTemp": 13.82, + "minScreenAirTemp": 13.56, + "screenDewPointTemperature": 12.5, + "feelsLikeTemperature": 10.53, + "windSpeed10m": 8.6, + "windDirectionFrom10m": 205, + "windGustSpeed10m": 16.28, + "max10mWindGust": 16.62, + "visibility": 29418, + "screenRelativeHumidity": 91.67, + "mslp": 99363, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 1.07, + "totalPrecipAmount": 0.21, + "totalSnowAmount": 0, + "probOfPrecipitation": 63 + }, + { + "time": "2024-11-23T22:00Z", + "screenTemperature": 14.07, + "maxScreenAirTemp": 14.08, + "minScreenAirTemp": 13.81, + "screenDewPointTemperature": 12.65, + "feelsLikeTemperature": 10.85, + "windSpeed10m": 8.42, + "windDirectionFrom10m": 204, + "windGustSpeed10m": 16.18, + "max10mWindGust": 16.85, + "visibility": 42192, + "screenRelativeHumidity": 91.08, + "mslp": 99382, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 14 + }, + { + "time": "2024-11-23T23:00Z", + "screenTemperature": 14.08, + "maxScreenAirTemp": 14.12, + "minScreenAirTemp": 14.05, + "screenDewPointTemperature": 12.78, + "feelsLikeTemperature": 10.96, + "windSpeed10m": 8.16, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 15.48, + "max10mWindGust": 16.29, + "visibility": 23225, + "screenRelativeHumidity": 91.85, + "mslp": 99372, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.89, + "totalPrecipAmount": 0.11, + "totalSnowAmount": 0, + "probOfPrecipitation": 61 + }, + { + "time": "2024-11-24T00:00Z", + "screenTemperature": 14.21, + "maxScreenAirTemp": 14.25, + "minScreenAirTemp": 14.08, + "screenDewPointTemperature": 12.64, + "feelsLikeTemperature": 10.87, + "windSpeed10m": 8.72, + "windDirectionFrom10m": 199, + "windGustSpeed10m": 16.6, + "max10mWindGust": 16.69, + "visibility": 42290, + "screenRelativeHumidity": 90.27, + "mslp": 99344, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 24 + }, + { + "time": "2024-11-24T01:00Z", + "screenTemperature": 14.28, + "maxScreenAirTemp": 14.3, + "minScreenAirTemp": 14.21, + "screenDewPointTemperature": 12.72, + "feelsLikeTemperature": 10.74, + "windSpeed10m": 9.29, + "windDirectionFrom10m": 199, + "windGustSpeed10m": 17.46, + "max10mWindGust": 17.85, + "visibility": 33325, + "screenRelativeHumidity": 90.21, + "mslp": 99303, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 19 + }, + { + "time": "2024-11-24T02:00Z", + "screenTemperature": 14.23, + "maxScreenAirTemp": 14.29, + "minScreenAirTemp": 14.19, + "screenDewPointTemperature": 12.69, + "feelsLikeTemperature": 10.54, + "windSpeed10m": 9.65, + "windDirectionFrom10m": 197, + "windGustSpeed10m": 18.14, + "max10mWindGust": 19.37, + "visibility": 20882, + "screenRelativeHumidity": 90.42, + "mslp": 99282, + "uvIndex": 0, + "significantWeatherCode": 13, + "precipitationRate": 0.89, + "totalPrecipAmount": 0.16, + "totalSnowAmount": 0, + "probOfPrecipitation": 70 + }, + { + "time": "2024-11-24T03:00Z", + "screenTemperature": 14.42, + "maxScreenAirTemp": 14.43, + "minScreenAirTemp": 14.23, + "screenDewPointTemperature": 12.72, + "feelsLikeTemperature": 10.6, + "windSpeed10m": 9.95, + "windDirectionFrom10m": 198, + "windGustSpeed10m": 18.53, + "max10mWindGust": 19.32, + "visibility": 32364, + "screenRelativeHumidity": 89.41, + "mslp": 99242, + "uvIndex": 0, + "significantWeatherCode": 9, + "precipitationRate": 0.1, + "totalPrecipAmount": 0.06, + "totalSnowAmount": 0, + "probOfPrecipitation": 31 + }, + { + "time": "2024-11-24T04:00Z", + "screenTemperature": 14.51, + "maxScreenAirTemp": 14.58, + "minScreenAirTemp": 14.42, + "screenDewPointTemperature": 12.6, + "feelsLikeTemperature": 10.63, + "windSpeed10m": 10.05, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 18.86, + "max10mWindGust": 19.09, + "visibility": 15355, + "screenRelativeHumidity": 88.25, + "mslp": 99212, + "uvIndex": 0, + "significantWeatherCode": 9, + "precipitationRate": 0.38, + "totalPrecipAmount": 0.23, + "totalSnowAmount": 0, + "probOfPrecipitation": 40 + }, + { + "time": "2024-11-24T05:00Z", + "screenTemperature": 14.48, + "maxScreenAirTemp": 14.52, + "minScreenAirTemp": 14.47, + "screenDewPointTemperature": 12.37, + "feelsLikeTemperature": 10.53, + "windSpeed10m": 10.16, + "windDirectionFrom10m": 195, + "windGustSpeed10m": 18.76, + "max10mWindGust": 18.81, + "visibility": 29205, + "screenRelativeHumidity": 87.08, + "mslp": 99183, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 22 + }, + { + "time": "2024-11-24T06:00Z", + "screenTemperature": 14.53, + "maxScreenAirTemp": 14.57, + "minScreenAirTemp": 14.48, + "screenDewPointTemperature": 12.34, + "feelsLikeTemperature": 10.54, + "windSpeed10m": 10.23, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 18.81, + "max10mWindGust": 18.9, + "visibility": 25187, + "screenRelativeHumidity": 86.67, + "mslp": 99182, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 22 + }, + { + "time": "2024-11-24T07:00Z", + "screenTemperature": 14.72, + "maxScreenAirTemp": 14.73, + "minScreenAirTemp": 14.53, + "screenDewPointTemperature": 12.51, + "feelsLikeTemperature": 10.69, + "windSpeed10m": 10.33, + "windDirectionFrom10m": 194, + "windGustSpeed10m": 19, + "max10mWindGust": 19, + "visibility": 31443, + "screenRelativeHumidity": 86.55, + "mslp": 99173, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 15 + }, + { + "time": "2024-11-24T08:00Z", + "screenTemperature": 14.74, + "maxScreenAirTemp": 14.79, + "minScreenAirTemp": 14.71, + "screenDewPointTemperature": 12.36, + "feelsLikeTemperature": 10.7, + "windSpeed10m": 10.27, + "windDirectionFrom10m": 193, + "windGustSpeed10m": 18.91, + "max10mWindGust": 19.17, + "visibility": 24964, + "screenRelativeHumidity": 85.71, + "mslp": 99182, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.52, + "totalPrecipAmount": 0.04, + "totalSnowAmount": 0, + "probOfPrecipitation": 52 + }, + { + "time": "2024-11-24T09:00Z", + "screenTemperature": 14.78, + "maxScreenAirTemp": 14.81, + "minScreenAirTemp": 14.72, + "screenDewPointTemperature": 12.35, + "feelsLikeTemperature": 10.63, + "windSpeed10m": 10.56, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 19.44, + "max10mWindGust": 19.44, + "visibility": 16181, + "screenRelativeHumidity": 85.33, + "mslp": 99173, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.36, + "totalPrecipAmount": 0.2, + "totalSnowAmount": 0, + "probOfPrecipitation": 53 + }, + { + "time": "2024-11-24T10:00Z", + "screenTemperature": 14.88, + "maxScreenAirTemp": 14.91, + "minScreenAirTemp": 14.78, + "screenDewPointTemperature": 12.28, + "feelsLikeTemperature": 10.47, + "windSpeed10m": 11.1, + "windDirectionFrom10m": 198, + "windGustSpeed10m": 20.32, + "max10mWindGust": 20.6, + "visibility": 22668, + "screenRelativeHumidity": 84.58, + "mslp": 99192, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.14, + "totalPrecipAmount": 0.05, + "totalSnowAmount": 0, + "probOfPrecipitation": 42 + }, + { + "time": "2024-11-24T11:00Z", + "screenTemperature": 15.3, + "maxScreenAirTemp": 15.33, + "minScreenAirTemp": 14.88, + "screenDewPointTemperature": 12.49, + "feelsLikeTemperature": 11.03, + "windSpeed10m": 10.55, + "windDirectionFrom10m": 201, + "windGustSpeed10m": 19.58, + "max10mWindGust": 19.77, + "visibility": 26957, + "screenRelativeHumidity": 83.56, + "mslp": 99220, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.2, + "totalPrecipAmount": 0.11, + "totalSnowAmount": 0, + "probOfPrecipitation": 44 + }, + { + "time": "2024-11-24T12:00Z", + "screenTemperature": 15.57, + "maxScreenAirTemp": 15.69, + "minScreenAirTemp": 15.3, + "screenDewPointTemperature": 12.54, + "feelsLikeTemperature": 11.45, + "windSpeed10m": 10.03, + "windDirectionFrom10m": 200, + "windGustSpeed10m": 19, + "max10mWindGust": 19, + "visibility": 19911, + "screenRelativeHumidity": 82.47, + "mslp": 99221, + "uvIndex": 1, + "significantWeatherCode": 15, + "precipitationRate": 0.83, + "totalPrecipAmount": 0.18, + "totalSnowAmount": 0, + "probOfPrecipitation": 81 + }, + { + "time": "2024-11-24T13:00Z", + "screenTemperature": 15.19, + "maxScreenAirTemp": 15.57, + "minScreenAirTemp": 15.16, + "screenDewPointTemperature": 12.23, + "feelsLikeTemperature": 10.93, + "windSpeed10m": 10.47, + "windDirectionFrom10m": 198, + "windGustSpeed10m": 19.58, + "max10mWindGust": 19.58, + "visibility": 23634, + "screenRelativeHumidity": 82.75, + "mslp": 99230, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.66, + "totalPrecipAmount": 0.15, + "totalSnowAmount": 0, + "probOfPrecipitation": 59 + }, + { + "time": "2024-11-24T14:00Z", + "screenTemperature": 15.16, + "maxScreenAirTemp": 15.19, + "minScreenAirTemp": 15.08, + "screenDewPointTemperature": 11.92, + "feelsLikeTemperature": 10.99, + "windSpeed10m": 10.24, + "windDirectionFrom10m": 202, + "windGustSpeed10m": 19.19, + "max10mWindGust": 19.19, + "visibility": 29843, + "screenRelativeHumidity": 81.2, + "mslp": 99230, + "uvIndex": 1, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 12 + }, + { + "time": "2024-11-24T15:00Z", + "screenTemperature": 14.97, + "maxScreenAirTemp": 15.16, + "minScreenAirTemp": 14.96, + "screenDewPointTemperature": 11.65, + "feelsLikeTemperature": 10.99, + "windSpeed10m": 9.74, + "windDirectionFrom10m": 203, + "windGustSpeed10m": 18.27, + "max10mWindGust": 18.82, + "visibility": 23608, + "screenRelativeHumidity": 80.72, + "mslp": 99239, + "uvIndex": 1, + "significantWeatherCode": 12, + "precipitationRate": 0.31, + "totalPrecipAmount": 0.07, + "totalSnowAmount": 0, + "probOfPrecipitation": 45 + }, + { + "time": "2024-11-24T16:00Z", + "screenTemperature": 14.76, + "maxScreenAirTemp": 14.97, + "minScreenAirTemp": 14.71, + "screenDewPointTemperature": 11.45, + "feelsLikeTemperature": 10.96, + "windSpeed10m": 9.42, + "windDirectionFrom10m": 200, + "windGustSpeed10m": 17.72, + "max10mWindGust": 17.84, + "visibility": 30385, + "screenRelativeHumidity": 80.72, + "mslp": 99229, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.18, + "totalPrecipAmount": 0.16, + "totalSnowAmount": 0, + "probOfPrecipitation": 48 + }, + { + "time": "2024-11-24T17:00Z", + "screenTemperature": 14.38, + "maxScreenAirTemp": 14.76, + "minScreenAirTemp": 14.31, + "screenDewPointTemperature": 11.36, + "feelsLikeTemperature": 10.87, + "windSpeed10m": 8.71, + "windDirectionFrom10m": 199, + "windGustSpeed10m": 16.39, + "max10mWindGust": 17.72, + "visibility": 26409, + "screenRelativeHumidity": 82.26, + "mslp": 99211, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.55, + "totalPrecipAmount": 0.51, + "totalSnowAmount": 0, + "probOfPrecipitation": 50 + }, + { + "time": "2024-11-24T18:00Z", + "screenTemperature": 14.27, + "maxScreenAirTemp": 14.38, + "minScreenAirTemp": 14.21, + "screenDewPointTemperature": 11.11, + "feelsLikeTemperature": 10.84, + "windSpeed10m": 8.56, + "windDirectionFrom10m": 196, + "windGustSpeed10m": 16.09, + "max10mWindGust": 16.09, + "visibility": 23645, + "screenRelativeHumidity": 81.33, + "mslp": 99164, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.43, + "totalPrecipAmount": 0.15, + "totalSnowAmount": 0, + "probOfPrecipitation": 55 + }, + { + "time": "2024-11-24T19:00Z", + "screenTemperature": 14.08, + "maxScreenAirTemp": 14.27, + "minScreenAirTemp": 14.07, + "screenDewPointTemperature": 10.51, + "feelsLikeTemperature": 10.35, + "windSpeed10m": 9.18, + "windDirectionFrom10m": 198, + "windGustSpeed10m": 17.08, + "max10mWindGust": 17.08, + "visibility": 28936, + "screenRelativeHumidity": 79.25, + "mslp": 99127, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.3, + "totalPrecipAmount": 0.18, + "totalSnowAmount": 0, + "probOfPrecipitation": 43 + }, + { + "time": "2024-11-24T20:00Z", + "screenTemperature": 13, + "maxScreenAirTemp": 14.08, + "minScreenAirTemp": 12.95, + "screenDewPointTemperature": 10.35, + "feelsLikeTemperature": 9.56, + "windSpeed10m": 8.42, + "windDirectionFrom10m": 215, + "windGustSpeed10m": 15.63, + "max10mWindGust": 16.07, + "visibility": 12200, + "screenRelativeHumidity": 84.28, + "mslp": 99154, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.97, + "totalPrecipAmount": 0.21, + "totalSnowAmount": 0, + "probOfPrecipitation": 56 + }, + { + "time": "2024-11-24T21:00Z", + "screenTemperature": 11.88, + "maxScreenAirTemp": 13, + "minScreenAirTemp": 11.87, + "screenDewPointTemperature": 10.08, + "feelsLikeTemperature": 9.07, + "windSpeed10m": 6.7, + "windDirectionFrom10m": 221, + "windGustSpeed10m": 12.78, + "max10mWindGust": 13.87, + "visibility": 10227, + "screenRelativeHumidity": 88.76, + "mslp": 99182, + "uvIndex": 0, + "significantWeatherCode": 15, + "precipitationRate": 1.04, + "totalPrecipAmount": 0.46, + "totalSnowAmount": 0, + "probOfPrecipitation": 86 + }, + { + "time": "2024-11-24T22:00Z", + "screenTemperature": 11.28, + "maxScreenAirTemp": 11.88, + "minScreenAirTemp": 11.24, + "screenDewPointTemperature": 9.54, + "feelsLikeTemperature": 8.44, + "windSpeed10m": 6.56, + "windDirectionFrom10m": 218, + "windGustSpeed10m": 12.47, + "max10mWindGust": 12.47, + "visibility": 12135, + "screenRelativeHumidity": 89.13, + "mslp": 99229, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.45, + "totalPrecipAmount": 0.35, + "totalSnowAmount": 0, + "probOfPrecipitation": 58 + }, + { + "time": "2024-11-24T23:00Z", + "screenTemperature": 10.8, + "maxScreenAirTemp": 11.28, + "minScreenAirTemp": 10.78, + "screenDewPointTemperature": 8.75, + "feelsLikeTemperature": 7.88, + "windSpeed10m": 6.7, + "windDirectionFrom10m": 212, + "windGustSpeed10m": 12.96, + "max10mWindGust": 12.96, + "visibility": 36419, + "screenRelativeHumidity": 87.18, + "mslp": 99267, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.3, + "totalPrecipAmount": 0.43, + "totalSnowAmount": 0, + "probOfPrecipitation": 52 + }, + { + "time": "2024-11-25T00:00Z", + "screenTemperature": 10.58, + "maxScreenAirTemp": 10.8, + "minScreenAirTemp": 10.56, + "screenDewPointTemperature": 8.06, + "feelsLikeTemperature": 7.78, + "windSpeed10m": 6.3, + "windDirectionFrom10m": 214, + "windGustSpeed10m": 12.27, + "max10mWindGust": 12.27, + "visibility": 44678, + "screenRelativeHumidity": 84.49, + "mslp": 99278, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.25, + "totalPrecipAmount": 0.31, + "totalSnowAmount": 0, + "probOfPrecipitation": 43 + }, + { + "time": "2024-11-25T01:00Z", + "screenTemperature": 10.49, + "maxScreenAirTemp": 10.58, + "minScreenAirTemp": 10.48, + "screenDewPointTemperature": 7.77, + "feelsLikeTemperature": 7.63, + "windSpeed10m": 6.36, + "windDirectionFrom10m": 211, + "windGustSpeed10m": 12.3, + "max10mWindGust": 12.3, + "visibility": 43617, + "screenRelativeHumidity": 83.39, + "mslp": 99278, + "uvIndex": 0, + "significantWeatherCode": 12, + "precipitationRate": 0.42, + "totalPrecipAmount": 0.23, + "totalSnowAmount": 0, + "probOfPrecipitation": 54 + }, + { + "time": "2024-11-25T02:00Z", + "screenTemperature": 10.18, + "maxScreenAirTemp": 10.49, + "minScreenAirTemp": 10.18, + "screenDewPointTemperature": 7.81, + "feelsLikeTemperature": 7.27, + "windSpeed10m": 6.43, + "windDirectionFrom10m": 204, + "windGustSpeed10m": 12.41, + "max10mWindGust": 12.41, + "visibility": 35252, + "screenRelativeHumidity": 85.21, + "mslp": 99287, + "uvIndex": 0, + "significantWeatherCode": 8, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 23 + }, + { + "time": "2024-11-25T03:00Z", + "screenTemperature": 10.14, + "maxScreenAirTemp": 10.18, + "minScreenAirTemp": 10.12, + "screenDewPointTemperature": 7.49, + "feelsLikeTemperature": 7.27, + "windSpeed10m": 6.3, + "windDirectionFrom10m": 202, + "windGustSpeed10m": 12.31, + "max10mWindGust": 12.85, + "visibility": 47099, + "screenRelativeHumidity": 83.6, + "mslp": 99279, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 8 + }, + { + "time": "2024-11-25T04:00Z", + "screenTemperature": 10.13, + "maxScreenAirTemp": 10.17, + "minScreenAirTemp": 10.11, + "screenDewPointTemperature": 7.42, + "feelsLikeTemperature": 7.26, + "windSpeed10m": 6.26, + "windDirectionFrom10m": 205, + "windGustSpeed10m": 12.08, + "max10mWindGust": 12.9, + "visibility": 44698, + "screenRelativeHumidity": 83.37, + "mslp": 99289, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 9 + }, + { + "time": "2024-11-25T05:00Z", + "screenTemperature": 10.09, + "maxScreenAirTemp": 10.13, + "minScreenAirTemp": 10.06, + "screenDewPointTemperature": 7.42, + "feelsLikeTemperature": 7.26, + "windSpeed10m": 6.12, + "windDirectionFrom10m": 206, + "windGustSpeed10m": 11.81, + "max10mWindGust": 12.36, + "visibility": 43814, + "screenRelativeHumidity": 83.54, + "mslp": 99299, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 6 + }, + { + "time": "2024-11-25T06:00Z", + "screenTemperature": 9.98, + "maxScreenAirTemp": 10.22, + "minScreenAirTemp": 9.97, + "screenDewPointTemperature": 7.16, + "feelsLikeTemperature": 7.23, + "windSpeed10m": 5.83, + "windDirectionFrom10m": 207, + "windGustSpeed10m": 11.26, + "max10mWindGust": 11.75, + "visibility": 41476, + "screenRelativeHumidity": 82.68, + "mslp": 99327, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 6 + }, + { + "time": "2024-11-25T07:00Z", + "screenTemperature": 9.89, + "maxScreenAirTemp": 9.98, + "minScreenAirTemp": 9.87, + "screenDewPointTemperature": 7.04, + "feelsLikeTemperature": 7.13, + "windSpeed10m": 5.82, + "windDirectionFrom10m": 211, + "windGustSpeed10m": 11.19, + "max10mWindGust": 11.19, + "visibility": 39207, + "screenRelativeHumidity": 82.5, + "mslp": 99379, + "uvIndex": 0, + "significantWeatherCode": 7, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 7 + }, + { + "time": "2024-11-25T08:00Z", + "screenTemperature": 9.76, + "maxScreenAirTemp": 9.89, + "minScreenAirTemp": 9.76, + "screenDewPointTemperature": 6.73, + "feelsLikeTemperature": 6.95, + "windSpeed10m": 5.85, + "windDirectionFrom10m": 215, + "windGustSpeed10m": 11.33, + "max10mWindGust": 11.33, + "visibility": 38949, + "screenRelativeHumidity": 81.47, + "mslp": 99458, + "uvIndex": 1, + "significantWeatherCode": 3, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 2 + }, + { + "time": "2024-11-25T09:00Z", + "screenTemperature": 9.74, + "maxScreenAirTemp": 9.77, + "minScreenAirTemp": 9.74, + "screenDewPointTemperature": 6.68, + "feelsLikeTemperature": 6.87, + "windSpeed10m": 6.07, + "windDirectionFrom10m": 218, + "windGustSpeed10m": 11.44, + "max10mWindGust": 11.44, + "visibility": 38081, + "screenRelativeHumidity": 81.26, + "mslp": 99536, + "uvIndex": 1, + "significantWeatherCode": 3, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 2 + }, + { + "time": "2024-11-25T10:00Z", + "screenTemperature": 10.07, + "maxScreenAirTemp": 10.07, + "minScreenAirTemp": 9.74, + "screenDewPointTemperature": 6.4, + "feelsLikeTemperature": 7.15, + "windSpeed10m": 6.35, + "windDirectionFrom10m": 223, + "windGustSpeed10m": 11.73, + "max10mWindGust": 11.73, + "visibility": 37260, + "screenRelativeHumidity": 78.14, + "mslp": 99596, + "uvIndex": 1, + "significantWeatherCode": 1, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T11:00Z", + "screenTemperature": 10.37, + "maxScreenAirTemp": 10.42, + "minScreenAirTemp": 10.07, + "screenDewPointTemperature": 5.91, + "feelsLikeTemperature": 7.4, + "windSpeed10m": 6.62, + "windDirectionFrom10m": 228, + "windGustSpeed10m": 12.04, + "max10mWindGust": 12.04, + "visibility": 37321, + "screenRelativeHumidity": 74, + "mslp": 99664, + "uvIndex": 1, + "significantWeatherCode": 1, + "precipitationRate": 0, + "totalPrecipAmount": 0, + "totalSnowAmount": 0, + "probOfPrecipitation": 1 + }, + { + "time": "2024-11-25T12:00Z", + "screenTemperature": 10.72, + "screenDewPointTemperature": 5.47, + "feelsLikeTemperature": 7.72, + "windSpeed10m": 6.91, + "windDirectionFrom10m": 233, + "windGustSpeed10m": 12.61, + "visibility": 38960, + "screenRelativeHumidity": 70.02, + "mslp": 99715, + "uvIndex": 1, + "significantWeatherCode": 1, + "precipitationRate": 0, + "probOfPrecipitation": 1 } ] } } - } - }, - "kingslynn_daily": { - "SiteRep": { - "Wx": { - "Param": [ - { - "name": "FDm", - "units": "C", - "$": "Feels Like Day Maximum Temperature" - }, - { - "name": "FNm", - "units": "C", - "$": "Feels Like Night Minimum Temperature" - }, - { - "name": "Dm", - "units": "C", - "$": "Day Maximum Temperature" - }, - { - "name": "Nm", - "units": "C", - "$": "Night Minimum Temperature" - }, - { - "name": "Gn", - "units": "mph", - "$": "Wind Gust Noon" - }, - { - "name": "Gm", - "units": "mph", - "$": "Wind Gust Midnight" - }, - { - "name": "Hn", - "units": "%", - "$": "Screen Relative Humidity Noon" - }, - { - "name": "Hm", - "units": "%", - "$": "Screen Relative Humidity Midnight" - }, - { - "name": "V", - "units": "", - "$": "Visibility" - }, - { - "name": "D", - "units": "compass", - "$": "Wind Direction" - }, - { - "name": "S", - "units": "mph", - "$": "Wind Speed" - }, - { - "name": "U", - "units": "", - "$": "Max UV Index" - }, - { - "name": "W", - "units": "", - "$": "Weather Type" - }, - { - "name": "PPd", - "units": "%", - "$": "Precipitation Probability Day" - }, - { - "name": "PPn", - "units": "%", - "$": "Precipitation Probability Night" - } - ] - }, - "DV": { - "dataDate": "2020-04-25T08:00:00Z", - "type": "Forecast", - "Location": { - "i": "322380", - "lat": "52.7561", - "lon": "0.4019", - "name": "KING'S LYNN", - "country": "ENGLAND", - "continent": "EUROPE", - "elevation": "5.0", - "Period": [ - { - "type": "Day", - "value": "2020-04-25Z", - "Rep": [ - { - "D": "ESE", - "Gn": "4", - "Hn": "75", - "PPd": "9", - "S": "4", - "V": "VG", - "Dm": "9", - "FDm": "8", - "W": "8", - "U": "3", - "$": "Day" - }, - { - "D": "SSE", - "Gm": "16", - "Hm": "84", - "PPn": "0", - "S": "7", - "V": "VG", - "Nm": "7", - "FNm": "5", - "W": "0", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-26Z", - "Rep": [ - { - "D": "SSW", - "Gn": "13", - "Hn": "69", - "PPd": "0", - "S": "9", - "V": "VG", - "Dm": "13", - "FDm": "11", - "W": "1", - "U": "4", - "$": "Day" - }, - { - "D": "SSW", - "Gm": "13", - "Hm": "75", - "PPn": "5", - "S": "7", - "V": "GO", - "Nm": "11", - "FNm": "10", - "W": "7", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-27Z", - "Rep": [ - { - "D": "NW", - "Gn": "11", - "Hn": "78", - "PPd": "36", - "S": "4", - "V": "VG", - "Dm": "10", - "FDm": "9", - "W": "7", - "U": "3", - "$": "Day" - }, - { - "D": "SE", - "Gm": "13", - "Hm": "85", - "PPn": "9", - "S": "7", - "V": "VG", - "Nm": "9", - "FNm": "7", - "W": "7", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-28Z", - "Rep": [ - { - "D": "ESE", - "Gn": "13", - "Hn": "77", - "PPd": "14", - "S": "7", - "V": "GO", - "Dm": "11", - "FDm": "9", - "W": "7", - "U": "3", - "$": "Day" - }, - { - "D": "SSE", - "Gm": "13", - "Hm": "87", - "PPn": "11", - "S": "7", - "V": "GO", - "Nm": "9", - "FNm": "7", - "W": "7", - "$": "Night" - } - ] - }, - { - "type": "Day", - "value": "2020-04-29Z", - "Rep": [ - { - "D": "SSE", - "Gn": "20", - "Hn": "75", - "PPd": "8", - "S": "11", - "V": "VG", - "Dm": "12", - "FDm": "10", - "W": "7", - "U": "3", - "$": "Day" - }, - { - "D": "SSE", - "Gm": "20", - "Hm": "86", - "PPn": "20", - "S": "11", - "V": "VG", - "Nm": "9", - "FNm": "7", - "W": "7", - "$": "Night" - } - ] + ], + "parameters": [ + { + "totalSnowAmount": { + "type": "Parameter", + "description": "Total Snow Amount Over Previous Hour", + "unit": { + "label": "millimetres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "mm" } - ] + } + }, + "screenTemperature": { + "type": "Parameter", + "description": "Screen Air Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "visibility": { + "type": "Parameter", + "description": "Visibility", + "unit": { + "label": "metres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m" + } + } + }, + "windDirectionFrom10m": { + "type": "Parameter", + "description": "10m Wind From Direction", + "unit": { + "label": "degrees", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "deg" + } + } + }, + "precipitationRate": { + "type": "Parameter", + "description": "Precipitation Rate", + "unit": { + "label": "millimetres per hour", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "mm/h" + } + } + }, + "maxScreenAirTemp": { + "type": "Parameter", + "description": "Maximum Screen Air Temperature Over Previous Hour", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "feelsLikeTemperature": { + "type": "Parameter", + "description": "Feels Like Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "screenDewPointTemperature": { + "type": "Parameter", + "description": "Screen Dew Point Temperature", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "screenRelativeHumidity": { + "type": "Parameter", + "description": "Screen Relative Humidity", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "windSpeed10m": { + "type": "Parameter", + "description": "10m Wind Speed", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "probOfPrecipitation": { + "type": "Parameter", + "description": "Probability of Precipitation", + "unit": { + "label": "percentage", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "%" + } + } + }, + "max10mWindGust": { + "type": "Parameter", + "description": "Maximum 10m Wind Gust Speed Over Previous Hour", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "significantWeatherCode": { + "type": "Parameter", + "description": "Significant Weather Code", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "https://datahub.metoffice.gov.uk/", + "type": "1" + } + } + }, + "minScreenAirTemp": { + "type": "Parameter", + "description": "Minimum Screen Air Temperature Over Previous Hour", + "unit": { + "label": "degrees Celsius", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Cel" + } + } + }, + "totalPrecipAmount": { + "type": "Parameter", + "description": "Total Precipitation Amount Over Previous Hour", + "unit": { + "label": "millimetres", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "mm" + } + } + }, + "mslp": { + "type": "Parameter", + "description": "Mean Sea Level Pressure", + "unit": { + "label": "pascals", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "Pa" + } + } + }, + "windGustSpeed10m": { + "type": "Parameter", + "description": "10m Wind Gust Speed", + "unit": { + "label": "metres per second", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "m/s" + } + } + }, + "uvIndex": { + "type": "Parameter", + "description": "UV Index", + "unit": { + "label": "dimensionless", + "symbol": { + "value": "http://www.opengis.net/def/uom/UCUM/", + "type": "1" + } + } } } - } + ] } } diff --git a/tests/components/metoffice/snapshots/test_weather.ambr b/tests/components/metoffice/snapshots/test_weather.ambr index 0bbc0e06a0ac2..41ccd0b008c54 100644 --- a/tests/components/metoffice/snapshots/test_weather.ambr +++ b/tests/components/metoffice/snapshots/test_weather.ambr @@ -1,39 +1,168 @@ # serializer version: 1 # name: test_forecast_service[get_forecasts] dict({ - 'weather.met_office_wavertree_daily': dict({ + 'weather.met_office_wavertree': dict({ 'forecast': list([ dict({ 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 13.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 23, + 'pressure': 987.12, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 211, + 'wind_gust_speed': 47.2, + 'wind_speed': 26.39, + }), + dict({ + 'apparent_temperature': 9.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 26, + 'pressure': 987.48, + 'temperature': 15.2, + 'templow': 11.9, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, + }), + dict({ + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 6, + 'pressure': 1004.81, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 262, + 'wind_gust_speed': 47.99, + 'wind_speed': 29.23, }), dict({ + 'apparent_temperature': 5.3, 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', - 'precipitation_probability': 14, + 'datetime': '2024-11-25T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 5, + 'pressure': 994.88, 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'templow': 8.4, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, }), dict({ 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-26T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 44, + 'pressure': 1013.9, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 74, + 'wind_gust_speed': 19.51, + 'wind_speed': 11.41, + }), + dict({ + 'apparent_temperature': 5.9, + 'condition': 'partlycloudy', + 'datetime': '2024-11-26T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 6, + 'pressure': 1012.93, + 'temperature': 10.1, + 'templow': 6.5, + 'uv_index': 1, + 'wind_bearing': 265, + 'wind_gust_speed': 34.49, + 'wind_speed': 20.45, }), dict({ + 'datetime': '2024-11-27T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 9, + 'pressure': 1021.75, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 31, + 'wind_gust_speed': 19.94, + 'wind_speed': 11.84, + }), + dict({ + 'apparent_temperature': 3.3, 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'datetime': '2024-11-27T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 43, + 'pressure': 1014.39, + 'temperature': 11.1, + 'templow': 3.0, + 'uv_index': 1, + 'wind_bearing': 8, + 'wind_gust_speed': 32.18, + 'wind_speed': 18.54, + }), + dict({ + 'condition': 'cloudy', + 'datetime': '2024-11-28T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 9, + 'pressure': 1023.82, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 131, + 'wind_gust_speed': 33.16, + 'wind_speed': 20.05, + }), + dict({ + 'apparent_temperature': 3.0, + 'condition': 'cloudy', + 'datetime': '2024-11-28T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 9, + 'pressure': 1025.12, + 'temperature': 9.4, + 'templow': 1.3, + 'uv_index': 1, + 'wind_bearing': 104, + 'wind_gust_speed': 22.36, + 'wind_speed': 12.64, + }), + dict({ + 'condition': 'cloudy', + 'datetime': '2024-11-29T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 13, + 'pressure': 1016.88, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 151, + 'wind_gust_speed': 33.16, + 'wind_speed': 20.12, + }), + dict({ + 'apparent_temperature': 4.9, + 'condition': 'cloudy', + 'datetime': '2024-11-29T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 11, + 'pressure': 1019.85, + 'temperature': 12.6, + 'templow': 4.2, + 'uv_index': 1, + 'wind_bearing': 137, + 'wind_gust_speed': 38.59, + 'wind_speed': 23.0, }), ]), }), @@ -41,287 +170,631 @@ # --- # name: test_forecast_service[get_forecasts].1 dict({ - 'weather.met_office_wavertree_daily': dict({ + 'weather.met_office_wavertree': dict({ 'forecast': list([ dict({ - 'condition': 'sunny', - 'datetime': '2020-04-25T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 19.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'apparent_temperature': 6.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T13:00:00+00:00', + 'precipitation': 0.52, + 'precipitation_probability': 65, + 'pressure': 986.83, + 'temperature': 9.9, + 'uv_index': 1, + 'wind_bearing': 178, + 'wind_gust_speed': 55.73, + 'wind_speed': 25.42, + }), + dict({ + 'apparent_temperature': 8.4, + 'condition': 'cloudy', + 'datetime': '2024-11-23T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.34, + 'temperature': 11.1, + 'uv_index': 1, + 'wind_bearing': 179, + 'wind_gust_speed': 49.0, + 'wind_speed': 22.86, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T18:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 17.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'apparent_temperature': 9.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T15:00:00+00:00', + 'precipitation': 0.09, + 'precipitation_probability': 37, + 'pressure': 986.13, + 'temperature': 12.0, + 'uv_index': 1, + 'wind_bearing': 182, + 'wind_gust_speed': 40.1, + 'wind_speed': 18.5, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T21:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 14.0, - 'wind_bearing': 'NW', - 'wind_speed': 3.22, + 'apparent_temperature': 10.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T16:00:00+00:00', + 'precipitation': 0.27, + 'precipitation_probability': 36, + 'pressure': 986.6, + 'temperature': 12.6, + 'uv_index': 0, + 'wind_bearing': 197, + 'wind_gust_speed': 35.86, + 'wind_speed': 15.44, + }), + dict({ + 'apparent_temperature': 11.3, + 'condition': 'cloudy', + 'datetime': '2024-11-23T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.1, + 'temperature': 12.9, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 35.57, + 'wind_speed': 15.59, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T00:00:00+00:00', - 'precipitation_probability': 1, + 'apparent_temperature': 11.3, + 'condition': 'cloudy', + 'datetime': '2024-11-23T18:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.1, 'temperature': 13.0, - 'wind_bearing': 'WSW', - 'wind_speed': 3.22, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 31.21, + 'wind_speed': 15.52, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T03:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'apparent_temperature': 11.1, + 'condition': 'pouring', + 'datetime': '2024-11-23T19:00:00+00:00', + 'precipitation': 0.51, + 'precipitation_probability': 74, + 'pressure': 986.82, + 'temperature': 13.0, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 37.44, + 'wind_speed': 17.46, }), dict({ + 'apparent_temperature': 11.2, 'condition': 'cloudy', - 'datetime': '2020-04-26T06:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'datetime': '2024-11-23T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 986.92, + 'temperature': 13.7, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 45.97, + 'wind_speed': 22.72, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-26T09:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-23T21:00:00+00:00', + 'precipitation': 0.11, + 'precipitation_probability': 30, + 'pressure': 986.82, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 178, + 'wind_gust_speed': 44.32, + 'wind_speed': 22.0, }), dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-23T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.31, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 47.84, + 'wind_speed': 23.65, }), dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-26T15:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-23T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 985.71, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 51.44, + 'wind_speed': 26.57, }), dict({ + 'apparent_temperature': 11.5, 'condition': 'cloudy', - 'datetime': '2020-04-26T18:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 984.92, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 171, + 'wind_gust_speed': 50.69, + 'wind_speed': 26.78, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-26T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'apparent_temperature': 11.6, + 'condition': 'rainy', + 'datetime': '2024-11-24T01:00:00+00:00', + 'precipitation': 0.17, + 'precipitation_probability': 40, + 'pressure': 984.22, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 170, + 'wind_gust_speed': 50.11, + 'wind_speed': 25.78, + }), + dict({ + 'apparent_temperature': 11.3, + 'condition': 'pouring', + 'datetime': '2024-11-24T02:00:00+00:00', + 'precipitation': 0.21, + 'precipitation_probability': 74, + 'pressure': 983.51, + 'temperature': 14.2, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 52.06, + 'wind_speed': 26.89, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'pouring', + 'datetime': '2024-11-24T03:00:00+00:00', + 'precipitation': 0.34, + 'precipitation_probability': 73, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 51.55, + 'wind_speed': 26.1, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T04:00:00+00:00', + 'precipitation': 0.28, + 'precipitation_probability': 50, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 189, + 'wind_gust_speed': 49.68, + 'wind_speed': 25.52, + }), + dict({ + 'apparent_temperature': 11.8, + 'condition': 'rainy', + 'datetime': '2024-11-24T05:00:00+00:00', + 'precipitation': 0.25, + 'precipitation_probability': 47, + 'pressure': 983.3, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.72, + 'wind_speed': 23.69, }), dict({ + 'apparent_temperature': 10.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T06:00:00+00:00', + 'precipitation': 0.3, + 'precipitation_probability': 42, + 'pressure': 983.96, + 'temperature': 13.4, + 'uv_index': 0, + 'wind_bearing': 216, + 'wind_gust_speed': 45.83, + 'wind_speed': 24.16, + }), + dict({ + 'apparent_temperature': 10.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T07:00:00+00:00', + 'precipitation': 0.16, + 'precipitation_probability': 40, + 'pressure': 984.58, + 'temperature': 12.5, + 'uv_index': 0, + 'wind_bearing': 214, + 'wind_gust_speed': 39.71, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.5, + 'condition': 'rainy', + 'datetime': '2024-11-24T08:00:00+00:00', + 'precipitation': 0.08, + 'precipitation_probability': 38, + 'pressure': 985.48, + 'temperature': 11.9, + 'uv_index': 0, + 'wind_bearing': 209, + 'wind_gust_speed': 37.08, + 'wind_speed': 19.73, + }), + dict({ + 'apparent_temperature': 9.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T09:00:00+00:00', + 'precipitation': 0.04, + 'precipitation_probability': 26, + 'pressure': 986.38, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 35.96, + 'wind_speed': 19.58, + }), + dict({ + 'apparent_temperature': 9.0, + 'condition': 'rainy', + 'datetime': '2024-11-24T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 25, + 'pressure': 986.96, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 37.01, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.2, 'condition': 'cloudy', - 'datetime': '2020-04-27T00:00:00+00:00', - 'precipitation_probability': 11, - 'temperature': 9.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'datetime': '2024-11-24T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 6, + 'pressure': 987.55, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 36.22, + 'wind_speed': 20.45, }), dict({ + 'apparent_temperature': 9.0, 'condition': 'cloudy', - 'datetime': '2020-04-27T03:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 8.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'datetime': '2024-11-24T12:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.48, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, }), dict({ + 'apparent_temperature': 8.8, 'condition': 'cloudy', - 'datetime': '2020-04-27T06:00:00+00:00', - 'precipitation_probability': 14, - 'temperature': 8.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'datetime': '2024-11-24T13:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.57, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 45.36, + 'wind_speed': 25.45, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 8.6, + 'condition': 'cloudy', + 'datetime': '2024-11-24T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.37, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 46.94, + 'wind_speed': 26.39, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', + 'apparent_temperature': 8.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T15:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 4, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'pressure': 987.27, + 'temperature': 11.6, + 'uv_index': 1, + 'wind_bearing': 198, + 'wind_gust_speed': 46.87, + 'wind_speed': 26.35, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 8.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T16:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.08, + 'temperature': 11.2, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.22, + 'wind_speed': 25.38, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T18:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'apparent_temperature': 8.0, + 'condition': 'cloudy', + 'datetime': '2024-11-24T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 986.89, + 'temperature': 11.0, + 'uv_index': 0, + 'wind_bearing': 194, + 'wind_gust_speed': 45.68, + 'wind_speed': 25.34, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-27T21:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'apparent_temperature': 7.8, + 'condition': 'cloudy', + 'datetime': '2024-11-24T18:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.7, + 'temperature': 10.9, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.15, + 'wind_speed': 25.34, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-28T00:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 8.0, - 'wind_bearing': 'NNW', - 'wind_speed': 6.44, + 'apparent_temperature': 7.8, + 'condition': 'cloudy', + 'datetime': '2024-11-24T19:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.69, + 'temperature': 10.8, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 45.43, + 'wind_speed': 24.95, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-28T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 7.0, - 'wind_bearing': 'W', - 'wind_speed': 6.44, + 'apparent_temperature': 7.7, + 'condition': 'cloudy', + 'datetime': '2024-11-24T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.78, + 'temperature': 10.7, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.07, + 'wind_speed': 24.55, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-28T06:00:00+00:00', + 'apparent_temperature': 7.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T21:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 6.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'pressure': 986.77, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 46.4, + 'wind_speed': 25.49, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-28T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'apparent_temperature': 7.3, + 'condition': 'cloudy', + 'datetime': '2024-11-24T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 987.04, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 204, + 'wind_gust_speed': 48.24, + 'wind_speed': 26.68, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-24T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.04, + 'temperature': 10.3, + 'uv_index': 0, + 'wind_bearing': 207, + 'wind_gust_speed': 50.44, + 'wind_speed': 27.72, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-28T15:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, + 'datetime': '2024-11-25T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 23, + 'pressure': 987.12, + 'temperature': 10.2, + 'uv_index': 0, + 'wind_bearing': 211, + 'wind_gust_speed': 47.2, + 'wind_speed': 26.39, + }), + dict({ + 'apparent_temperature': 6.9, + 'condition': 'cloudy', + 'datetime': '2024-11-25T01:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.41, + 'temperature': 10.0, + 'uv_index': 0, + 'wind_bearing': 215, + 'wind_gust_speed': 45.04, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 6.4, 'condition': 'cloudy', - 'datetime': '2020-04-28T18:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, + 'datetime': '2024-11-25T02:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.88, + 'temperature': 9.6, + 'uv_index': 0, + 'wind_bearing': 222, + 'wind_gust_speed': 46.87, + 'wind_speed': 25.7, + }), + dict({ + 'apparent_temperature': 6.1, + 'condition': 'cloudy', + 'datetime': '2024-11-25T03:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.16, + 'temperature': 9.3, + 'uv_index': 0, + 'wind_bearing': 226, + 'wind_gust_speed': 44.71, + 'wind_speed': 24.88, }), dict({ + 'apparent_temperature': 5.8, 'condition': 'cloudy', - 'datetime': '2020-04-28T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NNE', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T04:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.58, + 'temperature': 9.1, + 'uv_index': 0, + 'wind_bearing': 228, + 'wind_gust_speed': 45.22, + 'wind_speed': 25.34, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T00:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'E', - 'wind_speed': 6.44, + 'apparent_temperature': 5.4, + 'condition': 'clear-night', + 'datetime': '2024-11-25T05:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 989.1, + 'temperature': 8.8, + 'uv_index': 0, + 'wind_bearing': 232, + 'wind_gust_speed': 47.23, + 'wind_speed': 26.14, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-29T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 8.0, - 'wind_bearing': 'SSE', - 'wind_speed': 11.27, + 'apparent_temperature': 5.1, + 'condition': 'clear-night', + 'datetime': '2024-11-25T06:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 989.61, + 'temperature': 8.7, + 'uv_index': 0, + 'wind_bearing': 235, + 'wind_gust_speed': 48.2, + 'wind_speed': 26.35, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T06:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 8.0, - 'wind_bearing': 'SE', - 'wind_speed': 14.48, + 'apparent_temperature': 5.0, + 'condition': 'clear-night', + 'datetime': '2024-11-25T07:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 990.61, + 'temperature': 8.6, + 'uv_index': 0, + 'wind_bearing': 240, + 'wind_gust_speed': 47.81, + 'wind_speed': 26.78, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T09:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 10.0, - 'wind_bearing': 'SE', - 'wind_speed': 17.7, + 'apparent_temperature': 4.8, + 'condition': 'clear-night', + 'datetime': '2024-11-25T08:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 991.61, + 'temperature': 8.4, + 'uv_index': 0, + 'wind_bearing': 243, + 'wind_gust_speed': 47.56, + 'wind_speed': 26.86, }), dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 47, - 'temperature': 12.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'apparent_temperature': 4.8, + 'condition': 'sunny', + 'datetime': '2024-11-25T09:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 992.52, + 'temperature': 8.4, + 'uv_index': 1, + 'wind_bearing': 243, + 'wind_gust_speed': 47.84, + 'wind_speed': 27.32, }), dict({ - 'condition': 'pouring', - 'datetime': '2020-04-29T15:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'apparent_temperature': 5.0, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 993.42, + 'temperature': 8.7, + 'uv_index': 1, + 'wind_bearing': 245, + 'wind_gust_speed': 49.79, + 'wind_speed': 28.8, }), dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T18:00:00+00:00', - 'precipitation_probability': 39, - 'temperature': 12.0, - 'wind_bearing': 'SSE', - 'wind_speed': 17.7, + 'apparent_temperature': 5.0, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 3, + 'pressure': 994.24, + 'temperature': 8.8, + 'uv_index': 1, + 'wind_bearing': 249, + 'wind_gust_speed': 52.09, + 'wind_speed': 30.38, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T21:00:00+00:00', - 'precipitation_probability': 19, - 'temperature': 11.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'apparent_temperature': 5.2, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T12:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 2, + 'pressure': 994.88, + 'temperature': 8.9, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, }), ]), }), @@ -329,39 +802,168 @@ # --- # name: test_forecast_service[get_forecasts].2 dict({ - 'weather.met_office_wavertree_daily': dict({ + 'weather.met_office_wavertree': dict({ 'forecast': list([ dict({ 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 13.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 23, + 'pressure': 987.12, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 211, + 'wind_gust_speed': 47.2, + 'wind_speed': 26.39, + }), + dict({ + 'apparent_temperature': 9.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 26, + 'pressure': 987.48, + 'temperature': 15.2, + 'templow': 11.9, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, + }), + dict({ + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 6, + 'pressure': 1004.81, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 262, + 'wind_gust_speed': 47.99, + 'wind_speed': 29.23, }), dict({ + 'apparent_temperature': 5.3, 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', - 'precipitation_probability': 14, + 'datetime': '2024-11-25T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 5, + 'pressure': 994.88, 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'templow': 8.4, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, }), dict({ 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-26T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 44, + 'pressure': 1013.9, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 74, + 'wind_gust_speed': 19.51, + 'wind_speed': 11.41, + }), + dict({ + 'apparent_temperature': 5.9, + 'condition': 'partlycloudy', + 'datetime': '2024-11-26T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 6, + 'pressure': 1012.93, + 'temperature': 10.1, + 'templow': 6.5, + 'uv_index': 1, + 'wind_bearing': 265, + 'wind_gust_speed': 34.49, + 'wind_speed': 20.45, + }), + dict({ + 'datetime': '2024-11-27T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 9, + 'pressure': 1021.75, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 31, + 'wind_gust_speed': 19.94, + 'wind_speed': 11.84, }), dict({ + 'apparent_temperature': 3.3, 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'datetime': '2024-11-27T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 43, + 'pressure': 1014.39, + 'temperature': 11.1, + 'templow': 3.0, + 'uv_index': 1, + 'wind_bearing': 8, + 'wind_gust_speed': 32.18, + 'wind_speed': 18.54, + }), + dict({ + 'condition': 'cloudy', + 'datetime': '2024-11-28T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 9, + 'pressure': 1023.82, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 131, + 'wind_gust_speed': 33.16, + 'wind_speed': 20.05, + }), + dict({ + 'apparent_temperature': 3.0, + 'condition': 'cloudy', + 'datetime': '2024-11-28T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 9, + 'pressure': 1025.12, + 'temperature': 9.4, + 'templow': 1.3, + 'uv_index': 1, + 'wind_bearing': 104, + 'wind_gust_speed': 22.36, + 'wind_speed': 12.64, + }), + dict({ + 'condition': 'cloudy', + 'datetime': '2024-11-29T00:00:00+00:00', + 'is_daytime': False, + 'precipitation_probability': 13, + 'pressure': 1016.88, + 'temperature': None, + 'templow': None, + 'uv_index': None, + 'wind_bearing': 151, + 'wind_gust_speed': 33.16, + 'wind_speed': 20.12, + }), + dict({ + 'apparent_temperature': 4.9, + 'condition': 'cloudy', + 'datetime': '2024-11-29T12:00:00+00:00', + 'is_daytime': True, + 'precipitation_probability': 11, + 'pressure': 1019.85, + 'temperature': 12.6, + 'templow': 4.2, + 'uv_index': 1, + 'wind_bearing': 137, + 'wind_gust_speed': 38.59, + 'wind_speed': 23.0, }), ]), }), @@ -369,937 +971,1889 @@ # --- # name: test_forecast_service[get_forecasts].3 dict({ - 'weather.met_office_wavertree_daily': dict({ + 'weather.met_office_wavertree': dict({ 'forecast': list([ dict({ - 'condition': 'sunny', - 'datetime': '2020-04-25T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 19.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'apparent_temperature': 6.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T13:00:00+00:00', + 'precipitation': 0.52, + 'precipitation_probability': 65, + 'pressure': 986.83, + 'temperature': 9.9, + 'uv_index': 1, + 'wind_bearing': 178, + 'wind_gust_speed': 55.73, + 'wind_speed': 25.42, + }), + dict({ + 'apparent_temperature': 8.4, + 'condition': 'cloudy', + 'datetime': '2024-11-23T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.34, + 'temperature': 11.1, + 'uv_index': 1, + 'wind_bearing': 179, + 'wind_gust_speed': 49.0, + 'wind_speed': 22.86, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T18:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 17.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'apparent_temperature': 9.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T15:00:00+00:00', + 'precipitation': 0.09, + 'precipitation_probability': 37, + 'pressure': 986.13, + 'temperature': 12.0, + 'uv_index': 1, + 'wind_bearing': 182, + 'wind_gust_speed': 40.1, + 'wind_speed': 18.5, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T21:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 14.0, - 'wind_bearing': 'NW', - 'wind_speed': 3.22, + 'apparent_temperature': 10.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T16:00:00+00:00', + 'precipitation': 0.27, + 'precipitation_probability': 36, + 'pressure': 986.6, + 'temperature': 12.6, + 'uv_index': 0, + 'wind_bearing': 197, + 'wind_gust_speed': 35.86, + 'wind_speed': 15.44, + }), + dict({ + 'apparent_temperature': 11.3, + 'condition': 'cloudy', + 'datetime': '2024-11-23T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.1, + 'temperature': 12.9, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 35.57, + 'wind_speed': 15.59, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T00:00:00+00:00', - 'precipitation_probability': 1, + 'apparent_temperature': 11.3, + 'condition': 'cloudy', + 'datetime': '2024-11-23T18:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.1, 'temperature': 13.0, - 'wind_bearing': 'WSW', - 'wind_speed': 3.22, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 31.21, + 'wind_speed': 15.52, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T03:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'apparent_temperature': 11.1, + 'condition': 'pouring', + 'datetime': '2024-11-23T19:00:00+00:00', + 'precipitation': 0.51, + 'precipitation_probability': 74, + 'pressure': 986.82, + 'temperature': 13.0, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 37.44, + 'wind_speed': 17.46, }), dict({ + 'apparent_temperature': 11.2, 'condition': 'cloudy', - 'datetime': '2020-04-26T06:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'datetime': '2024-11-23T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 986.92, + 'temperature': 13.7, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 45.97, + 'wind_speed': 22.72, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-26T09:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-23T21:00:00+00:00', + 'precipitation': 0.11, + 'precipitation_probability': 30, + 'pressure': 986.82, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 178, + 'wind_gust_speed': 44.32, + 'wind_speed': 22.0, }), dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-23T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.31, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 47.84, + 'wind_speed': 23.65, }), dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-26T15:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-23T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 985.71, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 51.44, + 'wind_speed': 26.57, }), dict({ + 'apparent_temperature': 11.5, 'condition': 'cloudy', - 'datetime': '2020-04-26T18:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 984.92, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 171, + 'wind_gust_speed': 50.69, + 'wind_speed': 26.78, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-26T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'apparent_temperature': 11.6, + 'condition': 'rainy', + 'datetime': '2024-11-24T01:00:00+00:00', + 'precipitation': 0.17, + 'precipitation_probability': 40, + 'pressure': 984.22, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 170, + 'wind_gust_speed': 50.11, + 'wind_speed': 25.78, + }), + dict({ + 'apparent_temperature': 11.3, + 'condition': 'pouring', + 'datetime': '2024-11-24T02:00:00+00:00', + 'precipitation': 0.21, + 'precipitation_probability': 74, + 'pressure': 983.51, + 'temperature': 14.2, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 52.06, + 'wind_speed': 26.89, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'pouring', + 'datetime': '2024-11-24T03:00:00+00:00', + 'precipitation': 0.34, + 'precipitation_probability': 73, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 51.55, + 'wind_speed': 26.1, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T04:00:00+00:00', + 'precipitation': 0.28, + 'precipitation_probability': 50, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 189, + 'wind_gust_speed': 49.68, + 'wind_speed': 25.52, + }), + dict({ + 'apparent_temperature': 11.8, + 'condition': 'rainy', + 'datetime': '2024-11-24T05:00:00+00:00', + 'precipitation': 0.25, + 'precipitation_probability': 47, + 'pressure': 983.3, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.72, + 'wind_speed': 23.69, }), dict({ + 'apparent_temperature': 10.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T06:00:00+00:00', + 'precipitation': 0.3, + 'precipitation_probability': 42, + 'pressure': 983.96, + 'temperature': 13.4, + 'uv_index': 0, + 'wind_bearing': 216, + 'wind_gust_speed': 45.83, + 'wind_speed': 24.16, + }), + dict({ + 'apparent_temperature': 10.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T07:00:00+00:00', + 'precipitation': 0.16, + 'precipitation_probability': 40, + 'pressure': 984.58, + 'temperature': 12.5, + 'uv_index': 0, + 'wind_bearing': 214, + 'wind_gust_speed': 39.71, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.5, + 'condition': 'rainy', + 'datetime': '2024-11-24T08:00:00+00:00', + 'precipitation': 0.08, + 'precipitation_probability': 38, + 'pressure': 985.48, + 'temperature': 11.9, + 'uv_index': 0, + 'wind_bearing': 209, + 'wind_gust_speed': 37.08, + 'wind_speed': 19.73, + }), + dict({ + 'apparent_temperature': 9.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T09:00:00+00:00', + 'precipitation': 0.04, + 'precipitation_probability': 26, + 'pressure': 986.38, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 35.96, + 'wind_speed': 19.58, + }), + dict({ + 'apparent_temperature': 9.0, + 'condition': 'rainy', + 'datetime': '2024-11-24T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 25, + 'pressure': 986.96, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 37.01, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.2, 'condition': 'cloudy', - 'datetime': '2020-04-27T00:00:00+00:00', - 'precipitation_probability': 11, - 'temperature': 9.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'datetime': '2024-11-24T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 6, + 'pressure': 987.55, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 36.22, + 'wind_speed': 20.45, }), dict({ + 'apparent_temperature': 9.0, 'condition': 'cloudy', - 'datetime': '2020-04-27T03:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 8.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'datetime': '2024-11-24T12:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.48, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, }), dict({ + 'apparent_temperature': 8.8, 'condition': 'cloudy', - 'datetime': '2020-04-27T06:00:00+00:00', - 'precipitation_probability': 14, - 'temperature': 8.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'datetime': '2024-11-24T13:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.57, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 45.36, + 'wind_speed': 25.45, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 8.6, + 'condition': 'cloudy', + 'datetime': '2024-11-24T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.37, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 46.94, + 'wind_speed': 26.39, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', + 'apparent_temperature': 8.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T15:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 4, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'pressure': 987.27, + 'temperature': 11.6, + 'uv_index': 1, + 'wind_bearing': 198, + 'wind_gust_speed': 46.87, + 'wind_speed': 26.35, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 8.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T16:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.08, + 'temperature': 11.2, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.22, + 'wind_speed': 25.38, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T18:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'apparent_temperature': 8.0, + 'condition': 'cloudy', + 'datetime': '2024-11-24T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 986.89, + 'temperature': 11.0, + 'uv_index': 0, + 'wind_bearing': 194, + 'wind_gust_speed': 45.68, + 'wind_speed': 25.34, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-27T21:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'apparent_temperature': 7.8, + 'condition': 'cloudy', + 'datetime': '2024-11-24T18:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.7, + 'temperature': 10.9, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.15, + 'wind_speed': 25.34, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-28T00:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 8.0, - 'wind_bearing': 'NNW', - 'wind_speed': 6.44, + 'apparent_temperature': 7.8, + 'condition': 'cloudy', + 'datetime': '2024-11-24T19:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.69, + 'temperature': 10.8, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 45.43, + 'wind_speed': 24.95, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-28T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 7.0, - 'wind_bearing': 'W', - 'wind_speed': 6.44, + 'apparent_temperature': 7.7, + 'condition': 'cloudy', + 'datetime': '2024-11-24T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.78, + 'temperature': 10.7, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.07, + 'wind_speed': 24.55, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-28T06:00:00+00:00', + 'apparent_temperature': 7.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T21:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 6.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'pressure': 986.77, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 46.4, + 'wind_speed': 25.49, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-28T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'apparent_temperature': 7.3, + 'condition': 'cloudy', + 'datetime': '2024-11-24T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 987.04, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 204, + 'wind_gust_speed': 48.24, + 'wind_speed': 26.68, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-24T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.04, + 'temperature': 10.3, + 'uv_index': 0, + 'wind_bearing': 207, + 'wind_gust_speed': 50.44, + 'wind_speed': 27.72, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-28T15:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, + 'datetime': '2024-11-25T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 23, + 'pressure': 987.12, + 'temperature': 10.2, + 'uv_index': 0, + 'wind_bearing': 211, + 'wind_gust_speed': 47.2, + 'wind_speed': 26.39, + }), + dict({ + 'apparent_temperature': 6.9, + 'condition': 'cloudy', + 'datetime': '2024-11-25T01:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.41, + 'temperature': 10.0, + 'uv_index': 0, + 'wind_bearing': 215, + 'wind_gust_speed': 45.04, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 6.4, 'condition': 'cloudy', - 'datetime': '2020-04-28T18:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, + 'datetime': '2024-11-25T02:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.88, + 'temperature': 9.6, + 'uv_index': 0, + 'wind_bearing': 222, + 'wind_gust_speed': 46.87, + 'wind_speed': 25.7, + }), + dict({ + 'apparent_temperature': 6.1, + 'condition': 'cloudy', + 'datetime': '2024-11-25T03:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.16, + 'temperature': 9.3, + 'uv_index': 0, + 'wind_bearing': 226, + 'wind_gust_speed': 44.71, + 'wind_speed': 24.88, }), dict({ + 'apparent_temperature': 5.8, 'condition': 'cloudy', - 'datetime': '2020-04-28T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NNE', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T04:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.58, + 'temperature': 9.1, + 'uv_index': 0, + 'wind_bearing': 228, + 'wind_gust_speed': 45.22, + 'wind_speed': 25.34, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T00:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'E', - 'wind_speed': 6.44, + 'apparent_temperature': 5.4, + 'condition': 'clear-night', + 'datetime': '2024-11-25T05:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 989.1, + 'temperature': 8.8, + 'uv_index': 0, + 'wind_bearing': 232, + 'wind_gust_speed': 47.23, + 'wind_speed': 26.14, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-29T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 8.0, - 'wind_bearing': 'SSE', - 'wind_speed': 11.27, + 'apparent_temperature': 5.1, + 'condition': 'clear-night', + 'datetime': '2024-11-25T06:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 989.61, + 'temperature': 8.7, + 'uv_index': 0, + 'wind_bearing': 235, + 'wind_gust_speed': 48.2, + 'wind_speed': 26.35, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T06:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 8.0, - 'wind_bearing': 'SE', - 'wind_speed': 14.48, + 'apparent_temperature': 5.0, + 'condition': 'clear-night', + 'datetime': '2024-11-25T07:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 990.61, + 'temperature': 8.6, + 'uv_index': 0, + 'wind_bearing': 240, + 'wind_gust_speed': 47.81, + 'wind_speed': 26.78, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T09:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 10.0, - 'wind_bearing': 'SE', - 'wind_speed': 17.7, + 'apparent_temperature': 4.8, + 'condition': 'clear-night', + 'datetime': '2024-11-25T08:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 991.61, + 'temperature': 8.4, + 'uv_index': 0, + 'wind_bearing': 243, + 'wind_gust_speed': 47.56, + 'wind_speed': 26.86, }), dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 47, - 'temperature': 12.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'apparent_temperature': 4.8, + 'condition': 'sunny', + 'datetime': '2024-11-25T09:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 992.52, + 'temperature': 8.4, + 'uv_index': 1, + 'wind_bearing': 243, + 'wind_gust_speed': 47.84, + 'wind_speed': 27.32, }), dict({ - 'condition': 'pouring', - 'datetime': '2020-04-29T15:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'apparent_temperature': 5.0, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 993.42, + 'temperature': 8.7, + 'uv_index': 1, + 'wind_bearing': 245, + 'wind_gust_speed': 49.79, + 'wind_speed': 28.8, }), dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T18:00:00+00:00', - 'precipitation_probability': 39, - 'temperature': 12.0, - 'wind_bearing': 'SSE', - 'wind_speed': 17.7, + 'apparent_temperature': 5.0, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 3, + 'pressure': 994.24, + 'temperature': 8.8, + 'uv_index': 1, + 'wind_bearing': 249, + 'wind_gust_speed': 52.09, + 'wind_speed': 30.38, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T21:00:00+00:00', - 'precipitation_probability': 19, - 'temperature': 11.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'apparent_temperature': 5.2, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T12:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 2, + 'pressure': 994.88, + 'temperature': 8.9, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, }), ]), }), }) # --- -# name: test_forecast_service[get_forecasts].4 - dict({ - 'weather.met_office_wavertree_daily': dict({ - 'forecast': list([ - ]), - }), - }) -# --- -# name: test_forecast_subscription[daily] +# name: test_forecast_subscription list([ dict({ + 'apparent_temperature': 6.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T13:00:00+00:00', + 'precipitation': 0.52, + 'precipitation_probability': 65, + 'pressure': 986.83, + 'temperature': 9.9, + 'uv_index': 1, + 'wind_bearing': 178, + 'wind_gust_speed': 55.73, + 'wind_speed': 25.42, + }), + dict({ + 'apparent_temperature': 8.4, + 'condition': 'cloudy', + 'datetime': '2024-11-23T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.34, + 'temperature': 11.1, + 'uv_index': 1, + 'wind_bearing': 179, + 'wind_gust_speed': 49.0, + 'wind_speed': 22.86, + }), + dict({ + 'apparent_temperature': 9.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T15:00:00+00:00', + 'precipitation': 0.09, + 'precipitation_probability': 37, + 'pressure': 986.13, + 'temperature': 12.0, + 'uv_index': 1, + 'wind_bearing': 182, + 'wind_gust_speed': 40.1, + 'wind_speed': 18.5, + }), + dict({ + 'apparent_temperature': 10.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T16:00:00+00:00', + 'precipitation': 0.27, + 'precipitation_probability': 36, + 'pressure': 986.6, + 'temperature': 12.6, + 'uv_index': 0, + 'wind_bearing': 197, + 'wind_gust_speed': 35.86, + 'wind_speed': 15.44, + }), + dict({ + 'apparent_temperature': 11.3, + 'condition': 'cloudy', + 'datetime': '2024-11-23T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.1, + 'temperature': 12.9, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 35.57, + 'wind_speed': 15.59, + }), + dict({ + 'apparent_temperature': 11.3, 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 9, + 'datetime': '2024-11-23T18:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.1, 'temperature': 13.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 31.21, + 'wind_speed': 15.52, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', - 'precipitation_probability': 14, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 11.1, + 'condition': 'pouring', + 'datetime': '2024-11-23T19:00:00+00:00', + 'precipitation': 0.51, + 'precipitation_probability': 74, + 'pressure': 986.82, + 'temperature': 13.0, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 37.44, + 'wind_speed': 17.46, }), dict({ + 'apparent_temperature': 11.2, 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-23T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 986.92, + 'temperature': 13.7, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 45.97, + 'wind_speed': 22.72, }), dict({ + 'apparent_temperature': 11.7, 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'datetime': '2024-11-23T21:00:00+00:00', + 'precipitation': 0.11, + 'precipitation_probability': 30, + 'pressure': 986.82, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 178, + 'wind_gust_speed': 44.32, + 'wind_speed': 22.0, }), - ]) -# --- -# name: test_forecast_subscription[daily].1 - list([ dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 13.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-23T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.31, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 47.84, + 'wind_speed': 23.65, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', - 'precipitation_probability': 14, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 11.4, + 'condition': 'cloudy', + 'datetime': '2024-11-23T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 985.71, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 51.44, + 'wind_speed': 26.57, }), dict({ + 'apparent_temperature': 11.5, 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', + 'datetime': '2024-11-24T00:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'pressure': 984.92, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 171, + 'wind_gust_speed': 50.69, + 'wind_speed': 26.78, }), dict({ + 'apparent_temperature': 11.6, 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'datetime': '2024-11-24T01:00:00+00:00', + 'precipitation': 0.17, + 'precipitation_probability': 40, + 'pressure': 984.22, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 170, + 'wind_gust_speed': 50.11, + 'wind_speed': 25.78, + }), + dict({ + 'apparent_temperature': 11.3, + 'condition': 'pouring', + 'datetime': '2024-11-24T02:00:00+00:00', + 'precipitation': 0.21, + 'precipitation_probability': 74, + 'pressure': 983.51, + 'temperature': 14.2, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 52.06, + 'wind_speed': 26.89, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'pouring', + 'datetime': '2024-11-24T03:00:00+00:00', + 'precipitation': 0.34, + 'precipitation_probability': 73, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 51.55, + 'wind_speed': 26.1, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T04:00:00+00:00', + 'precipitation': 0.28, + 'precipitation_probability': 50, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 189, + 'wind_gust_speed': 49.68, + 'wind_speed': 25.52, + }), + dict({ + 'apparent_temperature': 11.8, + 'condition': 'rainy', + 'datetime': '2024-11-24T05:00:00+00:00', + 'precipitation': 0.25, + 'precipitation_probability': 47, + 'pressure': 983.3, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.72, + 'wind_speed': 23.69, }), - ]) -# --- -# name: test_forecast_subscription[hourly] - list([ dict({ - 'condition': 'sunny', - 'datetime': '2020-04-25T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 19.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'apparent_temperature': 10.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T06:00:00+00:00', + 'precipitation': 0.3, + 'precipitation_probability': 42, + 'pressure': 983.96, + 'temperature': 13.4, + 'uv_index': 0, + 'wind_bearing': 216, + 'wind_gust_speed': 45.83, + 'wind_speed': 24.16, + }), + dict({ + 'apparent_temperature': 10.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T07:00:00+00:00', + 'precipitation': 0.16, + 'precipitation_probability': 40, + 'pressure': 984.58, + 'temperature': 12.5, + 'uv_index': 0, + 'wind_bearing': 214, + 'wind_gust_speed': 39.71, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.5, + 'condition': 'rainy', + 'datetime': '2024-11-24T08:00:00+00:00', + 'precipitation': 0.08, + 'precipitation_probability': 38, + 'pressure': 985.48, + 'temperature': 11.9, + 'uv_index': 0, + 'wind_bearing': 209, + 'wind_gust_speed': 37.08, + 'wind_speed': 19.73, + }), + dict({ + 'apparent_temperature': 9.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T09:00:00+00:00', + 'precipitation': 0.04, + 'precipitation_probability': 26, + 'pressure': 986.38, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 35.96, + 'wind_speed': 19.58, + }), + dict({ + 'apparent_temperature': 9.0, + 'condition': 'rainy', + 'datetime': '2024-11-24T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 25, + 'pressure': 986.96, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 37.01, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 6, + 'pressure': 987.55, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 36.22, + 'wind_speed': 20.45, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T18:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 17.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'apparent_temperature': 9.0, + 'condition': 'cloudy', + 'datetime': '2024-11-24T12:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.48, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T21:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 14.0, - 'wind_bearing': 'NW', - 'wind_speed': 3.22, + 'apparent_temperature': 8.8, + 'condition': 'cloudy', + 'datetime': '2024-11-24T13:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.57, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 45.36, + 'wind_speed': 25.45, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T00:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 13.0, - 'wind_bearing': 'WSW', - 'wind_speed': 3.22, + 'apparent_temperature': 8.6, + 'condition': 'cloudy', + 'datetime': '2024-11-24T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.37, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 46.94, + 'wind_speed': 26.39, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T03:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'apparent_temperature': 8.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T15:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 987.27, + 'temperature': 11.6, + 'uv_index': 1, + 'wind_bearing': 198, + 'wind_gust_speed': 46.87, + 'wind_speed': 26.35, }), dict({ + 'apparent_temperature': 8.2, 'condition': 'cloudy', - 'datetime': '2020-04-26T06:00:00+00:00', + 'datetime': '2024-11-24T16:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, + 'pressure': 987.08, + 'temperature': 11.2, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.22, + 'wind_speed': 25.38, + }), + dict({ + 'apparent_temperature': 8.0, + 'condition': 'cloudy', + 'datetime': '2024-11-24T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 986.89, 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'uv_index': 0, + 'wind_bearing': 194, + 'wind_gust_speed': 45.68, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 7.8, 'condition': 'cloudy', - 'datetime': '2020-04-26T09:00:00+00:00', + 'datetime': '2024-11-24T18:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'pressure': 986.7, + 'temperature': 10.9, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.15, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 7.8, 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T19:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.69, + 'temperature': 10.8, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 45.43, + 'wind_speed': 24.95, }), dict({ + 'apparent_temperature': 7.7, 'condition': 'cloudy', - 'datetime': '2020-04-26T15:00:00+00:00', + 'datetime': '2024-11-24T20:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'pressure': 986.78, + 'temperature': 10.7, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.07, + 'wind_speed': 24.55, }), dict({ + 'apparent_temperature': 7.5, 'condition': 'cloudy', - 'datetime': '2020-04-26T18:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T21:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.77, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 46.4, + 'wind_speed': 25.49, }), dict({ + 'apparent_temperature': 7.3, 'condition': 'cloudy', - 'datetime': '2020-04-26T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'datetime': '2024-11-24T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 987.04, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 204, + 'wind_gust_speed': 48.24, + 'wind_speed': 26.68, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-27T00:00:00+00:00', - 'precipitation_probability': 11, - 'temperature': 9.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'datetime': '2024-11-24T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.04, + 'temperature': 10.3, + 'uv_index': 0, + 'wind_bearing': 207, + 'wind_gust_speed': 50.44, + 'wind_speed': 27.72, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-27T03:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 8.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'datetime': '2024-11-25T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 23, + 'pressure': 987.12, + 'temperature': 10.2, + 'uv_index': 0, + 'wind_bearing': 211, + 'wind_gust_speed': 47.2, + 'wind_speed': 26.39, + }), + dict({ + 'apparent_temperature': 6.9, + 'condition': 'cloudy', + 'datetime': '2024-11-25T01:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.41, + 'temperature': 10.0, + 'uv_index': 0, + 'wind_bearing': 215, + 'wind_gust_speed': 45.04, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 6.4, 'condition': 'cloudy', - 'datetime': '2020-04-27T06:00:00+00:00', - 'precipitation_probability': 14, - 'temperature': 8.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T02:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.88, + 'temperature': 9.6, + 'uv_index': 0, + 'wind_bearing': 222, + 'wind_gust_speed': 46.87, + 'wind_speed': 25.7, + }), + dict({ + 'apparent_temperature': 6.1, + 'condition': 'cloudy', + 'datetime': '2024-11-25T03:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.16, + 'temperature': 9.3, + 'uv_index': 0, + 'wind_bearing': 226, + 'wind_gust_speed': 44.71, + 'wind_speed': 24.88, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 5.8, + 'condition': 'cloudy', + 'datetime': '2024-11-25T04:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.58, + 'temperature': 9.1, + 'uv_index': 0, + 'wind_bearing': 228, + 'wind_gust_speed': 45.22, + 'wind_speed': 25.34, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', - 'precipitation_probability': 4, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 5.4, + 'condition': 'clear-night', + 'datetime': '2024-11-25T05:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 989.1, + 'temperature': 8.8, + 'uv_index': 0, + 'wind_bearing': 232, + 'wind_gust_speed': 47.23, + 'wind_speed': 26.14, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T15:00:00+00:00', + 'apparent_temperature': 5.1, + 'condition': 'clear-night', + 'datetime': '2024-11-25T06:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'pressure': 989.61, + 'temperature': 8.7, + 'uv_index': 0, + 'wind_bearing': 235, + 'wind_gust_speed': 48.2, + 'wind_speed': 26.35, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T18:00:00+00:00', + 'apparent_temperature': 5.0, + 'condition': 'clear-night', + 'datetime': '2024-11-25T07:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'pressure': 990.61, + 'temperature': 8.6, + 'uv_index': 0, + 'wind_bearing': 240, + 'wind_gust_speed': 47.81, + 'wind_speed': 26.78, }), dict({ + 'apparent_temperature': 4.8, 'condition': 'clear-night', - 'datetime': '2020-04-27T21:00:00+00:00', + 'datetime': '2024-11-25T08:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 1, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'pressure': 991.61, + 'temperature': 8.4, + 'uv_index': 0, + 'wind_bearing': 243, + 'wind_gust_speed': 47.56, + 'wind_speed': 26.86, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-28T00:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 8.0, - 'wind_bearing': 'NNW', - 'wind_speed': 6.44, + 'apparent_temperature': 4.8, + 'condition': 'sunny', + 'datetime': '2024-11-25T09:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 992.52, + 'temperature': 8.4, + 'uv_index': 1, + 'wind_bearing': 243, + 'wind_gust_speed': 47.84, + 'wind_speed': 27.32, }), dict({ - 'condition': 'clear-night', - 'datetime': '2020-04-28T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 7.0, - 'wind_bearing': 'W', - 'wind_speed': 6.44, + 'apparent_temperature': 5.0, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 993.42, + 'temperature': 8.7, + 'uv_index': 1, + 'wind_bearing': 245, + 'wind_gust_speed': 49.79, + 'wind_speed': 28.8, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-28T06:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 6.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'apparent_temperature': 5.0, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 3, + 'pressure': 994.24, + 'temperature': 8.8, + 'uv_index': 1, + 'wind_bearing': 249, + 'wind_gust_speed': 52.09, + 'wind_speed': 30.38, }), dict({ + 'apparent_temperature': 5.2, 'condition': 'partlycloudy', - 'datetime': '2020-04-28T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-25T12:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 2, + 'pressure': 994.88, + 'temperature': 8.9, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, }), + ]) +# --- +# name: test_forecast_subscription.1 + list([ dict({ + 'apparent_temperature': 6.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T13:00:00+00:00', + 'precipitation': 0.52, + 'precipitation_probability': 65, + 'pressure': 986.83, + 'temperature': 9.9, + 'uv_index': 1, + 'wind_bearing': 178, + 'wind_gust_speed': 55.73, + 'wind_speed': 25.42, + }), + dict({ + 'apparent_temperature': 8.4, 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, + 'datetime': '2024-11-23T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.34, + 'temperature': 11.1, + 'uv_index': 1, + 'wind_bearing': 179, + 'wind_gust_speed': 49.0, + 'wind_speed': 22.86, }), dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-28T15:00:00+00:00', - 'precipitation_probability': 10, + 'apparent_temperature': 9.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T15:00:00+00:00', + 'precipitation': 0.09, + 'precipitation_probability': 37, + 'pressure': 986.13, 'temperature': 12.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, + 'uv_index': 1, + 'wind_bearing': 182, + 'wind_gust_speed': 40.1, + 'wind_speed': 18.5, }), dict({ + 'apparent_temperature': 10.8, + 'condition': 'rainy', + 'datetime': '2024-11-23T16:00:00+00:00', + 'precipitation': 0.27, + 'precipitation_probability': 36, + 'pressure': 986.6, + 'temperature': 12.6, + 'uv_index': 0, + 'wind_bearing': 197, + 'wind_gust_speed': 35.86, + 'wind_speed': 15.44, + }), + dict({ + 'apparent_temperature': 11.3, 'condition': 'cloudy', - 'datetime': '2020-04-28T18:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, + 'datetime': '2024-11-23T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 987.1, + 'temperature': 12.9, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 35.57, + 'wind_speed': 15.59, }), dict({ + 'apparent_temperature': 11.3, 'condition': 'cloudy', - 'datetime': '2020-04-28T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NNE', - 'wind_speed': 6.44, + 'datetime': '2024-11-23T18:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.1, + 'temperature': 13.0, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 31.21, + 'wind_speed': 15.52, + }), + dict({ + 'apparent_temperature': 11.1, + 'condition': 'pouring', + 'datetime': '2024-11-23T19:00:00+00:00', + 'precipitation': 0.51, + 'precipitation_probability': 74, + 'pressure': 986.82, + 'temperature': 13.0, + 'uv_index': 0, + 'wind_bearing': 177, + 'wind_gust_speed': 37.44, + 'wind_speed': 17.46, }), dict({ + 'apparent_temperature': 11.2, 'condition': 'cloudy', - 'datetime': '2020-04-29T00:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'E', - 'wind_speed': 6.44, + 'datetime': '2024-11-23T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 11, + 'pressure': 986.92, + 'temperature': 13.7, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 45.97, + 'wind_speed': 22.72, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-29T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 8.0, - 'wind_bearing': 'SSE', - 'wind_speed': 11.27, + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-23T21:00:00+00:00', + 'precipitation': 0.11, + 'precipitation_probability': 30, + 'pressure': 986.82, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 178, + 'wind_gust_speed': 44.32, + 'wind_speed': 22.0, }), dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-29T06:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 8.0, - 'wind_bearing': 'SE', - 'wind_speed': 14.48, + 'datetime': '2024-11-23T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 12, + 'pressure': 986.31, + 'temperature': 14.0, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 47.84, + 'wind_speed': 23.65, }), dict({ + 'apparent_temperature': 11.4, 'condition': 'cloudy', - 'datetime': '2020-04-29T09:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 10.0, - 'wind_bearing': 'SE', - 'wind_speed': 17.7, + 'datetime': '2024-11-23T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 985.71, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 51.44, + 'wind_speed': 26.57, }), dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 47, - 'temperature': 12.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, + 'apparent_temperature': 11.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 10, + 'pressure': 984.92, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 171, + 'wind_gust_speed': 50.69, + 'wind_speed': 26.78, }), dict({ + 'apparent_temperature': 11.6, + 'condition': 'rainy', + 'datetime': '2024-11-24T01:00:00+00:00', + 'precipitation': 0.17, + 'precipitation_probability': 40, + 'pressure': 984.22, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 170, + 'wind_gust_speed': 50.11, + 'wind_speed': 25.78, + }), + dict({ + 'apparent_temperature': 11.3, 'condition': 'pouring', - 'datetime': '2020-04-29T15:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'datetime': '2024-11-24T02:00:00+00:00', + 'precipitation': 0.21, + 'precipitation_probability': 74, + 'pressure': 983.51, + 'temperature': 14.2, + 'uv_index': 0, + 'wind_bearing': 176, + 'wind_gust_speed': 52.06, + 'wind_speed': 26.89, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'pouring', + 'datetime': '2024-11-24T03:00:00+00:00', + 'precipitation': 0.34, + 'precipitation_probability': 73, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 187, + 'wind_gust_speed': 51.55, + 'wind_speed': 26.1, + }), + dict({ + 'apparent_temperature': 11.7, + 'condition': 'rainy', + 'datetime': '2024-11-24T04:00:00+00:00', + 'precipitation': 0.28, + 'precipitation_probability': 50, + 'pressure': 983.1, + 'temperature': 14.4, + 'uv_index': 0, + 'wind_bearing': 189, + 'wind_gust_speed': 49.68, + 'wind_speed': 25.52, + }), + dict({ + 'apparent_temperature': 11.8, + 'condition': 'rainy', + 'datetime': '2024-11-24T05:00:00+00:00', + 'precipitation': 0.25, + 'precipitation_probability': 47, + 'pressure': 983.3, + 'temperature': 14.3, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.72, + 'wind_speed': 23.69, }), dict({ + 'apparent_temperature': 10.7, 'condition': 'rainy', - 'datetime': '2020-04-29T18:00:00+00:00', - 'precipitation_probability': 39, - 'temperature': 12.0, - 'wind_bearing': 'SSE', - 'wind_speed': 17.7, + 'datetime': '2024-11-24T06:00:00+00:00', + 'precipitation': 0.3, + 'precipitation_probability': 42, + 'pressure': 983.96, + 'temperature': 13.4, + 'uv_index': 0, + 'wind_bearing': 216, + 'wind_gust_speed': 45.83, + 'wind_speed': 24.16, + }), + dict({ + 'apparent_temperature': 10.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T07:00:00+00:00', + 'precipitation': 0.16, + 'precipitation_probability': 40, + 'pressure': 984.58, + 'temperature': 12.5, + 'uv_index': 0, + 'wind_bearing': 214, + 'wind_gust_speed': 39.71, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.5, + 'condition': 'rainy', + 'datetime': '2024-11-24T08:00:00+00:00', + 'precipitation': 0.08, + 'precipitation_probability': 38, + 'pressure': 985.48, + 'temperature': 11.9, + 'uv_index': 0, + 'wind_bearing': 209, + 'wind_gust_speed': 37.08, + 'wind_speed': 19.73, + }), + dict({ + 'apparent_temperature': 9.1, + 'condition': 'rainy', + 'datetime': '2024-11-24T09:00:00+00:00', + 'precipitation': 0.04, + 'precipitation_probability': 26, + 'pressure': 986.38, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 35.96, + 'wind_speed': 19.58, + }), + dict({ + 'apparent_temperature': 9.0, + 'condition': 'rainy', + 'datetime': '2024-11-24T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 25, + 'pressure': 986.96, + 'temperature': 11.5, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 37.01, + 'wind_speed': 20.59, + }), + dict({ + 'apparent_temperature': 9.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T11:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 6, + 'pressure': 987.55, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 199, + 'wind_gust_speed': 36.22, + 'wind_speed': 20.45, }), dict({ + 'apparent_temperature': 9.0, 'condition': 'cloudy', - 'datetime': '2020-04-29T21:00:00+00:00', - 'precipitation_probability': 19, - 'temperature': 11.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'datetime': '2024-11-24T12:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.48, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, }), - ]) -# --- -# name: test_forecast_subscription[hourly].1 - list([ dict({ - 'condition': 'sunny', - 'datetime': '2020-04-25T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 19.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'apparent_temperature': 8.8, + 'condition': 'cloudy', + 'datetime': '2024-11-24T13:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.57, + 'temperature': 11.8, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 45.36, + 'wind_speed': 25.45, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T18:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 17.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, + 'apparent_temperature': 8.6, + 'condition': 'cloudy', + 'datetime': '2024-11-24T14:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.37, + 'temperature': 11.7, + 'uv_index': 1, + 'wind_bearing': 201, + 'wind_gust_speed': 46.94, + 'wind_speed': 26.39, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-25T21:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 14.0, - 'wind_bearing': 'NW', - 'wind_speed': 3.22, + 'apparent_temperature': 8.5, + 'condition': 'cloudy', + 'datetime': '2024-11-24T15:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 987.27, + 'temperature': 11.6, + 'uv_index': 1, + 'wind_bearing': 198, + 'wind_gust_speed': 46.87, + 'wind_speed': 26.35, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T00:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 13.0, - 'wind_bearing': 'WSW', - 'wind_speed': 3.22, + 'apparent_temperature': 8.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T16:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.08, + 'temperature': 11.2, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.22, + 'wind_speed': 25.38, }), dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-26T03:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'apparent_temperature': 8.0, + 'condition': 'cloudy', + 'datetime': '2024-11-24T17:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 986.89, + 'temperature': 11.0, + 'uv_index': 0, + 'wind_bearing': 194, + 'wind_gust_speed': 45.68, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 7.8, 'condition': 'cloudy', - 'datetime': '2020-04-26T06:00:00+00:00', + 'datetime': '2024-11-24T18:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'pressure': 986.7, + 'temperature': 10.9, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 46.15, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 7.8, 'condition': 'cloudy', - 'datetime': '2020-04-26T09:00:00+00:00', + 'datetime': '2024-11-24T19:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'pressure': 986.69, + 'temperature': 10.8, + 'uv_index': 0, + 'wind_bearing': 196, + 'wind_gust_speed': 45.43, + 'wind_speed': 24.95, }), dict({ + 'apparent_temperature': 7.7, 'condition': 'cloudy', - 'datetime': '2020-04-26T12:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 12.0, - 'wind_bearing': 'WNW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T20:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 986.78, + 'temperature': 10.7, + 'uv_index': 0, + 'wind_bearing': 202, + 'wind_gust_speed': 45.07, + 'wind_speed': 24.55, }), dict({ + 'apparent_temperature': 7.5, 'condition': 'cloudy', - 'datetime': '2020-04-26T15:00:00+00:00', + 'datetime': '2024-11-24T21:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 5, - 'temperature': 12.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'pressure': 986.77, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 203, + 'wind_gust_speed': 46.4, + 'wind_speed': 25.49, }), dict({ + 'apparent_temperature': 7.3, 'condition': 'cloudy', - 'datetime': '2020-04-26T18:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 11.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-24T22:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 4, + 'pressure': 987.04, + 'temperature': 10.5, + 'uv_index': 0, + 'wind_bearing': 204, + 'wind_gust_speed': 48.24, + 'wind_speed': 26.68, }), dict({ + 'apparent_temperature': 7.1, 'condition': 'cloudy', - 'datetime': '2020-04-26T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'datetime': '2024-11-24T23:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 987.04, + 'temperature': 10.3, + 'uv_index': 0, + 'wind_bearing': 207, + 'wind_gust_speed': 50.44, + 'wind_speed': 27.72, }), dict({ + 'apparent_temperature': 7.1, + 'condition': 'cloudy', + 'datetime': '2024-11-25T00:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 23, + 'pressure': 987.12, + 'temperature': 10.2, + 'uv_index': 0, + 'wind_bearing': 211, + 'wind_gust_speed': 47.2, + 'wind_speed': 26.39, + }), + dict({ + 'apparent_temperature': 6.9, 'condition': 'cloudy', - 'datetime': '2020-04-27T00:00:00+00:00', + 'datetime': '2024-11-25T01:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 11, - 'temperature': 9.0, - 'wind_bearing': 'WNW', - 'wind_speed': 6.44, + 'pressure': 987.41, + 'temperature': 10.0, + 'uv_index': 0, + 'wind_bearing': 215, + 'wind_gust_speed': 45.04, + 'wind_speed': 25.34, }), dict({ + 'apparent_temperature': 6.4, 'condition': 'cloudy', - 'datetime': '2020-04-27T03:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 8.0, - 'wind_bearing': 'WNW', - 'wind_speed': 11.27, - }), - dict({ + 'datetime': '2024-11-25T02:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 7, + 'pressure': 987.88, + 'temperature': 9.6, + 'uv_index': 0, + 'wind_bearing': 222, + 'wind_gust_speed': 46.87, + 'wind_speed': 25.7, + }), + dict({ + 'apparent_temperature': 6.1, 'condition': 'cloudy', - 'datetime': '2020-04-27T06:00:00+00:00', - 'precipitation_probability': 14, - 'temperature': 8.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, - }), - dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, - }), - dict({ - 'condition': 'partlycloudy', - 'datetime': '2020-04-27T12:00:00+00:00', - 'precipitation_probability': 4, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'datetime': '2024-11-25T03:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.16, + 'temperature': 9.3, + 'uv_index': 0, + 'wind_bearing': 226, + 'wind_gust_speed': 44.71, + 'wind_speed': 24.88, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T15:00:00+00:00', - 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 14.48, + 'apparent_temperature': 5.8, + 'condition': 'cloudy', + 'datetime': '2024-11-25T04:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 5, + 'pressure': 988.58, + 'temperature': 9.1, + 'uv_index': 0, + 'wind_bearing': 228, + 'wind_gust_speed': 45.22, + 'wind_speed': 25.34, }), dict({ - 'condition': 'sunny', - 'datetime': '2020-04-27T18:00:00+00:00', + 'apparent_temperature': 5.4, + 'condition': 'clear-night', + 'datetime': '2024-11-25T05:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 1, - 'temperature': 10.0, - 'wind_bearing': 'NW', - 'wind_speed': 11.27, + 'pressure': 989.1, + 'temperature': 8.8, + 'uv_index': 0, + 'wind_bearing': 232, + 'wind_gust_speed': 47.23, + 'wind_speed': 26.14, }), dict({ + 'apparent_temperature': 5.1, 'condition': 'clear-night', - 'datetime': '2020-04-27T21:00:00+00:00', + 'datetime': '2024-11-25T06:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 1, - 'temperature': 9.0, - 'wind_bearing': 'NW', - 'wind_speed': 6.44, + 'pressure': 989.61, + 'temperature': 8.7, + 'uv_index': 0, + 'wind_bearing': 235, + 'wind_gust_speed': 48.2, + 'wind_speed': 26.35, }), dict({ + 'apparent_temperature': 5.0, 'condition': 'clear-night', - 'datetime': '2020-04-28T00:00:00+00:00', - 'precipitation_probability': 2, - 'temperature': 8.0, - 'wind_bearing': 'NNW', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T07:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 990.61, + 'temperature': 8.6, + 'uv_index': 0, + 'wind_bearing': 240, + 'wind_gust_speed': 47.81, + 'wind_speed': 26.78, }), dict({ + 'apparent_temperature': 4.8, 'condition': 'clear-night', - 'datetime': '2020-04-28T03:00:00+00:00', - 'precipitation_probability': 3, - 'temperature': 7.0, - 'wind_bearing': 'W', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T08:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 991.61, + 'temperature': 8.4, + 'uv_index': 0, + 'wind_bearing': 243, + 'wind_gust_speed': 47.56, + 'wind_speed': 26.86, }), dict({ + 'apparent_temperature': 4.8, 'condition': 'sunny', - 'datetime': '2020-04-28T06:00:00+00:00', - 'precipitation_probability': 5, - 'temperature': 6.0, - 'wind_bearing': 'S', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T09:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 992.52, + 'temperature': 8.4, + 'uv_index': 1, + 'wind_bearing': 243, + 'wind_gust_speed': 47.84, + 'wind_speed': 27.32, }), dict({ + 'apparent_temperature': 5.0, 'condition': 'partlycloudy', - 'datetime': '2020-04-28T09:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-28T12:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'ENE', - 'wind_speed': 11.27, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-28T15:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 12.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-28T18:00:00+00:00', - 'precipitation_probability': 10, - 'temperature': 11.0, - 'wind_bearing': 'N', - 'wind_speed': 11.27, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-28T21:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 10.0, - 'wind_bearing': 'NNE', - 'wind_speed': 6.44, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T00:00:00+00:00', - 'precipitation_probability': 6, - 'temperature': 9.0, - 'wind_bearing': 'E', - 'wind_speed': 6.44, + 'datetime': '2024-11-25T10:00:00+00:00', + 'precipitation': 0.0, + 'precipitation_probability': 1, + 'pressure': 993.42, + 'temperature': 8.7, + 'uv_index': 1, + 'wind_bearing': 245, + 'wind_gust_speed': 49.79, + 'wind_speed': 28.8, }), dict({ + 'apparent_temperature': 5.0, 'condition': 'partlycloudy', - 'datetime': '2020-04-29T03:00:00+00:00', + 'datetime': '2024-11-25T11:00:00+00:00', + 'precipitation': 0.0, 'precipitation_probability': 3, - 'temperature': 8.0, - 'wind_bearing': 'SSE', - 'wind_speed': 11.27, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T06:00:00+00:00', - 'precipitation_probability': 9, - 'temperature': 8.0, - 'wind_bearing': 'SE', - 'wind_speed': 14.48, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T09:00:00+00:00', - 'precipitation_probability': 12, - 'temperature': 10.0, - 'wind_bearing': 'SE', - 'wind_speed': 17.7, - }), - dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T12:00:00+00:00', - 'precipitation_probability': 47, - 'temperature': 12.0, - 'wind_bearing': 'SE', - 'wind_speed': 20.92, - }), - dict({ - 'condition': 'pouring', - 'datetime': '2020-04-29T15:00:00+00:00', - 'precipitation_probability': 59, - 'temperature': 13.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'pressure': 994.24, + 'temperature': 8.8, + 'uv_index': 1, + 'wind_bearing': 249, + 'wind_gust_speed': 52.09, + 'wind_speed': 30.38, }), dict({ - 'condition': 'rainy', - 'datetime': '2020-04-29T18:00:00+00:00', - 'precipitation_probability': 39, - 'temperature': 12.0, - 'wind_bearing': 'SSE', - 'wind_speed': 17.7, - }), - dict({ - 'condition': 'cloudy', - 'datetime': '2020-04-29T21:00:00+00:00', - 'precipitation_probability': 19, - 'temperature': 11.0, - 'wind_bearing': 'SSE', - 'wind_speed': 20.92, + 'apparent_temperature': 5.2, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T12:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 2, + 'pressure': 994.88, + 'temperature': 8.9, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, }), ]) # --- diff --git a/tests/components/metoffice/test_config_flow.py b/tests/components/metoffice/test_config_flow.py index c2e75d89c1a78..fd46d09cc2cf5 100644 --- a/tests/components/metoffice/test_config_flow.py +++ b/tests/components/metoffice/test_config_flow.py @@ -28,8 +28,11 @@ async def test_form(hass: HomeAssistant, requests_mock: requests_mock.Mocker) -> # all metoffice test data encapsulated in here mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) - all_sites = json.dumps(mock_json["all_sites"]) - requests_mock.get("/public/data/val/wxfcs/all/json/sitelist/", text=all_sites) + wavertree_daily = json.dumps(mock_json["wavertree_daily"]) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, + ) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} @@ -66,17 +69,10 @@ async def test_form_already_configured( # all metoffice test data encapsulated in here mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) - - all_sites = json.dumps(mock_json["all_sites"]) - - requests_mock.get("/public/data/val/wxfcs/all/json/sitelist/", text=all_sites) + wavertree_daily = json.dumps(mock_json["wavertree_daily"]) requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=3hourly", - text="", - ) - requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=daily", - text="", + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, ) MockConfigEntry( @@ -102,7 +98,9 @@ async def test_form_cannot_connect( hass.config.latitude = TEST_LATITUDE_WAVERTREE hass.config.longitude = TEST_LONGITUDE_WAVERTREE - requests_mock.get("/public/data/val/wxfcs/all/json/sitelist/", text="") + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", text="" + ) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} @@ -122,7 +120,7 @@ async def test_form_unknown_error( ) -> None: """Test we handle unknown error.""" mock_instance = mock_simple_manager_fail.return_value - mock_instance.get_nearest_forecast_site.side_effect = ValueError + mock_instance.get_forecast.side_effect = ValueError result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} diff --git a/tests/components/metoffice/test_init.py b/tests/components/metoffice/test_init.py index 159587ca7c164..30fb9cba0ba8e 100644 --- a/tests/components/metoffice/test_init.py +++ b/tests/components/metoffice/test_init.py @@ -5,7 +5,6 @@ import datetime import pytest -import requests_mock from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.core import HomeAssistant @@ -16,68 +15,53 @@ from tests.common import MockConfigEntry -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) @pytest.mark.parametrize( ("old_unique_id", "new_unique_id", "migration_needed"), [ ( - f"Station Name_{TEST_COORDINATES_WAVERTREE}", - f"name_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"Weather_{TEST_COORDINATES_WAVERTREE}", f"weather_{TEST_COORDINATES_WAVERTREE}", + f"significantWeatherCode_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Temperature_{TEST_COORDINATES_WAVERTREE}", f"temperature_{TEST_COORDINATES_WAVERTREE}", + f"screenTemperature_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Feels Like Temperature_{TEST_COORDINATES_WAVERTREE}", f"feels_like_temperature_{TEST_COORDINATES_WAVERTREE}", + f"feelsLikeTemperature_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Wind Speed_{TEST_COORDINATES_WAVERTREE}", f"wind_speed_{TEST_COORDINATES_WAVERTREE}", + f"windSpeed10m_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Wind Direction_{TEST_COORDINATES_WAVERTREE}", f"wind_direction_{TEST_COORDINATES_WAVERTREE}", + f"windDirectionFrom10m_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Wind Gust_{TEST_COORDINATES_WAVERTREE}", f"wind_gust_{TEST_COORDINATES_WAVERTREE}", + f"windGustSpeed10m_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Visibility_{TEST_COORDINATES_WAVERTREE}", - f"visibility_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"Visibility Distance_{TEST_COORDINATES_WAVERTREE}", - f"visibility_distance_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"UV Index_{TEST_COORDINATES_WAVERTREE}", f"uv_{TEST_COORDINATES_WAVERTREE}", + f"uvIndex_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Probability of Precipitation_{TEST_COORDINATES_WAVERTREE}", f"precipitation_{TEST_COORDINATES_WAVERTREE}", + f"probOfPrecipitation_{TEST_COORDINATES_WAVERTREE}", True, ), ( - f"Humidity_{TEST_COORDINATES_WAVERTREE}", f"humidity_{TEST_COORDINATES_WAVERTREE}", + f"screenRelativeHumidity_{TEST_COORDINATES_WAVERTREE}", True, ), ( @@ -94,7 +78,6 @@ async def test_migrate_unique_id( old_unique_id: str, new_unique_id: str, migration_needed: bool, - requests_mock: requests_mock.Mocker, ) -> None: """Test unique id migration.""" diff --git a/tests/components/metoffice/test_sensor.py b/tests/components/metoffice/test_sensor.py index db84e85075ed7..e290edec5ac26 100644 --- a/tests/components/metoffice/test_sensor.py +++ b/tests/components/metoffice/test_sensor.py @@ -7,8 +7,9 @@ import requests_mock from homeassistant.components.metoffice.const import ATTRIBUTION, DOMAIN +from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.core import HomeAssistant -from homeassistant.helpers import device_registry as dr +from homeassistant.helpers import device_registry as dr, entity_registry as er from .const import ( DEVICE_KEY_KINGSLYNN, @@ -17,6 +18,8 @@ METOFFICE_CONFIG_KINGSLYNN, METOFFICE_CONFIG_WAVERTREE, TEST_DATETIME_STRING, + TEST_LATITUDE_WAVERTREE, + TEST_LONGITUDE_WAVERTREE, TEST_SITE_NAME_KINGSLYNN, TEST_SITE_NAME_WAVERTREE, WAVERTREE_SENSOR_RESULTS, @@ -25,7 +28,7 @@ from tests.common import MockConfigEntry, load_fixture -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_one_sensor_site_running( hass: HomeAssistant, device_registry: dr.DeviceRegistry, @@ -34,17 +37,15 @@ async def test_one_sensor_site_running( """Test the Met Office sensor platform.""" # all metoffice test data encapsulated in here mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) - all_sites = json.dumps(mock_json["all_sites"]) wavertree_hourly = json.dumps(mock_json["wavertree_hourly"]) wavertree_daily = json.dumps(mock_json["wavertree_daily"]) - requests_mock.get("/public/data/val/wxfcs/all/json/sitelist/", text=all_sites) requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=3hourly", + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", text=wavertree_hourly, ) requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=daily", + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", text=wavertree_daily, ) @@ -71,12 +72,11 @@ async def test_one_sensor_site_running( assert sensor.state == sensor_value assert sensor.attributes.get("last_update").isoformat() == TEST_DATETIME_STRING - assert sensor.attributes.get("site_id") == "354107" assert sensor.attributes.get("site_name") == TEST_SITE_NAME_WAVERTREE assert sensor.attributes.get("attribution") == ATTRIBUTION -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_two_sensor_sites_running( hass: HomeAssistant, device_registry: dr.DeviceRegistry, @@ -86,24 +86,18 @@ async def test_two_sensor_sites_running( # all metoffice test data encapsulated in here mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) - all_sites = json.dumps(mock_json["all_sites"]) wavertree_hourly = json.dumps(mock_json["wavertree_hourly"]) wavertree_daily = json.dumps(mock_json["wavertree_daily"]) kingslynn_hourly = json.dumps(mock_json["kingslynn_hourly"]) kingslynn_daily = json.dumps(mock_json["kingslynn_daily"]) - requests_mock.get("/public/data/val/wxfcs/all/json/sitelist/", text=all_sites) requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=3hourly", text=wavertree_hourly - ) - requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=daily", text=wavertree_daily - ) - requests_mock.get( - "/public/data/val/wxfcs/all/json/322380?res=3hourly", text=kingslynn_hourly + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=wavertree_hourly, ) requests_mock.get( - "/public/data/val/wxfcs/all/json/322380?res=daily", text=kingslynn_daily + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, ) entry = MockConfigEntry( @@ -112,6 +106,16 @@ async def test_two_sensor_sites_running( ) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) + + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=kingslynn_hourly, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=kingslynn_daily, + ) + entry2 = MockConfigEntry( domain=DOMAIN, data=METOFFICE_CONFIG_KINGSLYNN, @@ -135,14 +139,13 @@ async def test_two_sensor_sites_running( for running_id in running_sensor_ids: sensor = hass.states.get(running_id) sensor_id = sensor.attributes.get("sensor_id") - if sensor.attributes.get("site_id") == "354107": + if "wavertree" in running_id: _, sensor_value = WAVERTREE_SENSOR_RESULTS[sensor_id] assert sensor.state == sensor_value assert ( sensor.attributes.get("last_update").isoformat() == TEST_DATETIME_STRING ) assert sensor.attributes.get("sensor_id") == sensor_id - assert sensor.attributes.get("site_id") == "354107" assert sensor.attributes.get("site_name") == TEST_SITE_NAME_WAVERTREE assert sensor.attributes.get("attribution") == ATTRIBUTION @@ -153,6 +156,55 @@ async def test_two_sensor_sites_running( sensor.attributes.get("last_update").isoformat() == TEST_DATETIME_STRING ) assert sensor.attributes.get("sensor_id") == sensor_id - assert sensor.attributes.get("site_id") == "322380" assert sensor.attributes.get("site_name") == TEST_SITE_NAME_KINGSLYNN assert sensor.attributes.get("attribution") == ATTRIBUTION + + +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) +@pytest.mark.parametrize( + ("old_unique_id"), + [ + f"visibility_distance_{TEST_LATITUDE_WAVERTREE}_{TEST_LONGITUDE_WAVERTREE}", + f"visibility_distance_{TEST_LATITUDE_WAVERTREE}_{TEST_LONGITUDE_WAVERTREE}_daily", + ], +) +async def test_legacy_config_entry_is_removed( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + requests_mock: requests_mock.Mocker, + old_unique_id: str, +) -> None: + """Test the expected entities are deleted.""" + mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) + wavertree_hourly = json.dumps(mock_json["wavertree_hourly"]) + wavertree_daily = json.dumps(mock_json["wavertree_daily"]) + + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=wavertree_hourly, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, + ) + # Pre-create the entity + entity_registry.async_get_or_create( + SENSOR_DOMAIN, + DOMAIN, + unique_id=old_unique_id, + suggested_object_id="met_office_wavertree_visibility_distance", + ) + + entry = MockConfigEntry( + domain=DOMAIN, + data=METOFFICE_CONFIG_WAVERTREE, + ) + entry.add_to_hass(hass) + + await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() + + assert ( + entity_registry.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, old_unique_id) + is None + ) diff --git a/tests/components/metoffice/test_weather.py b/tests/components/metoffice/test_weather.py index 5176aff9e7d6f..63350fb8c73e3 100644 --- a/tests/components/metoffice/test_weather.py +++ b/tests/components/metoffice/test_weather.py @@ -47,29 +47,24 @@ async def wavertree_data(requests_mock: requests_mock.Mocker) -> dict[str, _Matc """Mock data for the Wavertree location.""" # all metoffice test data encapsulated in here mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) - all_sites = json.dumps(mock_json["all_sites"]) wavertree_hourly = json.dumps(mock_json["wavertree_hourly"]) wavertree_daily = json.dumps(mock_json["wavertree_daily"]) - sitelist_mock = requests_mock.get( - "/public/data/val/wxfcs/all/json/sitelist/", text=all_sites - ) wavertree_hourly_mock = requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=3hourly", + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", text=wavertree_hourly, ) wavertree_daily_mock = requests_mock.get( - "/public/data/val/wxfcs/all/json/354107?res=daily", + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", text=wavertree_daily, ) return { - "sitelist_mock": sitelist_mock, "wavertree_hourly_mock": wavertree_hourly_mock, "wavertree_daily_mock": wavertree_daily_mock, } -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_site_cannot_connect( hass: HomeAssistant, device_registry: dr.DeviceRegistry, @@ -77,9 +72,14 @@ async def test_site_cannot_connect( ) -> None: """Test we handle cannot connect error.""" - requests_mock.get("/public/data/val/wxfcs/all/json/sitelist/", text="") - requests_mock.get("/public/data/val/wxfcs/all/json/354107?res=3hourly", text="") - requests_mock.get("/public/data/val/wxfcs/all/json/354107?res=daily", text="") + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text="", + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text="", + ) entry = MockConfigEntry( domain=DOMAIN, @@ -91,15 +91,14 @@ async def test_site_cannot_connect( assert len(device_registry.devices) == 0 - assert hass.states.get("weather.met_office_wavertree_3hourly") is None - assert hass.states.get("weather.met_office_wavertree_daily") is None + assert hass.states.get("weather.met_office_wavertree") is None for sensor in WAVERTREE_SENSOR_RESULTS.values(): sensor_name = sensor[0] sensor = hass.states.get(f"sensor.wavertree_{sensor_name}") assert sensor is None -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_site_cannot_update( hass: HomeAssistant, requests_mock: requests_mock.Mocker, @@ -115,21 +114,27 @@ async def test_site_cannot_update( await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() - weather = hass.states.get("weather.met_office_wavertree_daily") + weather = hass.states.get("weather.met_office_wavertree") assert weather - requests_mock.get("/public/data/val/wxfcs/all/json/354107?res=3hourly", text="") - requests_mock.get("/public/data/val/wxfcs/all/json/354107?res=daily", text="") + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text="", + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text="", + ) - future_time = utcnow() + timedelta(minutes=20) + future_time = utcnow() + timedelta(minutes=40) async_fire_time_changed(hass, future_time) await hass.async_block_till_done(wait_background_tasks=True) - weather = hass.states.get("weather.met_office_wavertree_daily") + weather = hass.states.get("weather.met_office_wavertree") assert weather.state == STATE_UNAVAILABLE -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_one_weather_site_running( hass: HomeAssistant, device_registry: dr.DeviceRegistry, @@ -153,17 +158,17 @@ async def test_one_weather_site_running( assert device_wavertree.name == "Met Office Wavertree" # Wavertree daily weather platform expected results - weather = hass.states.get("weather.met_office_wavertree_daily") + weather = hass.states.get("weather.met_office_wavertree") assert weather - assert weather.state == "sunny" - assert weather.attributes.get("temperature") == 19 - assert weather.attributes.get("wind_speed") == 14.48 - assert weather.attributes.get("wind_bearing") == "SSE" - assert weather.attributes.get("humidity") == 50 + assert weather.state == "rainy" + assert weather.attributes.get("temperature") == 9.3 + assert weather.attributes.get("wind_speed") == 28.33 + assert weather.attributes.get("wind_bearing") == 176.0 + assert weather.attributes.get("humidity") == 95 -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_two_weather_sites_running( hass: HomeAssistant, device_registry: dr.DeviceRegistry, @@ -177,19 +182,23 @@ async def test_two_weather_sites_running( kingslynn_hourly = json.dumps(mock_json["kingslynn_hourly"]) kingslynn_daily = json.dumps(mock_json["kingslynn_daily"]) - requests_mock.get( - "/public/data/val/wxfcs/all/json/322380?res=3hourly", text=kingslynn_hourly - ) - requests_mock.get( - "/public/data/val/wxfcs/all/json/322380?res=daily", text=kingslynn_daily - ) - entry = MockConfigEntry( domain=DOMAIN, data=METOFFICE_CONFIG_WAVERTREE, ) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() + + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=kingslynn_hourly, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=kingslynn_daily, + ) + entry2 = MockConfigEntry( domain=DOMAIN, data=METOFFICE_CONFIG_KINGSLYNN, @@ -209,29 +218,29 @@ async def test_two_weather_sites_running( assert device_wavertree.name == "Met Office Wavertree" # Wavertree daily weather platform expected results - weather = hass.states.get("weather.met_office_wavertree_daily") + weather = hass.states.get("weather.met_office_wavertree") assert weather - assert weather.state == "sunny" - assert weather.attributes.get("temperature") == 19 - assert weather.attributes.get("wind_speed") == 14.48 + assert weather.state == "rainy" + assert weather.attributes.get("temperature") == 9.3 + assert weather.attributes.get("wind_speed") == 28.33 assert weather.attributes.get("wind_speed_unit") == "km/h" - assert weather.attributes.get("wind_bearing") == "SSE" - assert weather.attributes.get("humidity") == 50 + assert weather.attributes.get("wind_bearing") == 176.0 + assert weather.attributes.get("humidity") == 95 # King's Lynn daily weather platform expected results - weather = hass.states.get("weather.met_office_king_s_lynn_daily") + weather = hass.states.get("weather.met_office_king_s_lynn") assert weather - assert weather.state == "cloudy" - assert weather.attributes.get("temperature") == 9 - assert weather.attributes.get("wind_speed") == 6.44 + assert weather.state == "rainy" + assert weather.attributes.get("temperature") == 7.9 + assert weather.attributes.get("wind_speed") == 35.75 assert weather.attributes.get("wind_speed_unit") == "km/h" - assert weather.attributes.get("wind_bearing") == "ESE" - assert weather.attributes.get("humidity") == 75 + assert weather.attributes.get("wind_bearing") == 180.0 + assert weather.attributes.get("humidity") == 98 -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_new_config_entry( hass: HomeAssistant, entity_registry: er.EntityRegistry, no_sensor, wavertree_data ) -> None: @@ -250,7 +259,7 @@ async def test_new_config_entry( assert len(er.async_entries_for_config_entry(entity_registry, entry.entry_id)) == 1 -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) @pytest.mark.parametrize( ("service"), [SERVICE_GET_FORECASTS], @@ -276,12 +285,12 @@ async def test_forecast_service( assert wavertree_data["wavertree_daily_mock"].call_count == 1 assert wavertree_data["wavertree_hourly_mock"].call_count == 1 - for forecast_type in ("daily", "hourly"): + for forecast_type in ("twice_daily", "hourly"): response = await hass.services.async_call( WEATHER_DOMAIN, service, { - "entity_id": "weather.met_office_wavertree_daily", + "entity_id": "weather.met_office_wavertree", "type": forecast_type, }, blocking=True, @@ -289,24 +298,17 @@ async def test_forecast_service( ) assert response == snapshot - # Calling the services should use cached data - assert wavertree_data["wavertree_daily_mock"].call_count == 1 - assert wavertree_data["wavertree_hourly_mock"].call_count == 1 - # Trigger data refetch freezer.tick(DEFAULT_SCAN_INTERVAL + timedelta(seconds=1)) async_fire_time_changed(hass) await hass.async_block_till_done(wait_background_tasks=True) - assert wavertree_data["wavertree_daily_mock"].call_count == 2 - assert wavertree_data["wavertree_hourly_mock"].call_count == 1 - - for forecast_type in ("daily", "hourly"): + for forecast_type in ("twice_daily", "hourly"): response = await hass.services.async_call( WEATHER_DOMAIN, service, { - "entity_id": "weather.met_office_wavertree_daily", + "entity_id": "weather.met_office_wavertree", "type": forecast_type, }, blocking=True, @@ -314,41 +316,18 @@ async def test_forecast_service( ) assert response == snapshot - # Calling the services should update the hourly forecast - assert wavertree_data["wavertree_daily_mock"].call_count == 2 - assert wavertree_data["wavertree_hourly_mock"].call_count == 2 - - # Update fails - requests_mock.get("/public/data/val/wxfcs/all/json/354107?res=3hourly", text="") - - freezer.tick(DEFAULT_SCAN_INTERVAL + timedelta(seconds=1)) - async_fire_time_changed(hass) - await hass.async_block_till_done(wait_background_tasks=True) - - response = await hass.services.async_call( - WEATHER_DOMAIN, - service, - { - "entity_id": "weather.met_office_wavertree_daily", - "type": "hourly", - }, - blocking=True, - return_response=True, - ) - assert response == snapshot - -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_legacy_config_entry_is_removed( hass: HomeAssistant, entity_registry: er.EntityRegistry, no_sensor, wavertree_data ) -> None: """Test the expected entities are created.""" - # Pre-create the hourly entity + # Pre-create the daily entity entity_registry.async_get_or_create( WEATHER_DOMAIN, DOMAIN, "53.38374_-2.90929", - suggested_object_id="met_office_wavertree_3_hourly", + suggested_object_id="met_office_wavertree_daily", ) entry = MockConfigEntry( @@ -365,8 +344,7 @@ async def test_legacy_config_entry_is_removed( assert len(er.async_entries_for_config_entry(entity_registry, entry.entry_id)) == 1 -@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC)) -@pytest.mark.parametrize("forecast_type", ["daily", "hourly"]) +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_forecast_subscription( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, @@ -374,7 +352,6 @@ async def test_forecast_subscription( snapshot: SnapshotAssertion, no_sensor, wavertree_data: dict[str, _Matcher], - forecast_type: str, ) -> None: """Test multiple forecast.""" client = await hass_ws_client(hass) @@ -391,8 +368,8 @@ async def test_forecast_subscription( await client.send_json_auto_id( { "type": "weather/subscribe_forecast", - "forecast_type": forecast_type, - "entity_id": "weather.met_office_wavertree_daily", + "forecast_type": "hourly", + "entity_id": "weather.met_office_wavertree", } ) msg = await client.receive_json() From 718896096db6048aadf6d2fb4677f10491bd18ae Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Sun, 24 Nov 2024 14:31:15 +0000 Subject: [PATCH 02/12] Reauth test --- .../components/metoffice/strings.json | 3 +- .../components/metoffice/test_config_flow.py | 74 ++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/metoffice/strings.json b/homeassistant/components/metoffice/strings.json index 32f31618a0415..b80aa686b3a41 100644 --- a/homeassistant/components/metoffice/strings.json +++ b/homeassistant/components/metoffice/strings.json @@ -21,7 +21,8 @@ "unknown": "[%key:common::config_flow::error::unknown%]" }, "abort": { - "already_configured": "[%key:common::config_flow::abort::already_configured_service%]" + "already_configured": "[%key:common::config_flow::abort::already_configured_service%]", + "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]" } } } diff --git a/tests/components/metoffice/test_config_flow.py b/tests/components/metoffice/test_config_flow.py index fd46d09cc2cf5..83336ed03d91a 100644 --- a/tests/components/metoffice/test_config_flow.py +++ b/tests/components/metoffice/test_config_flow.py @@ -1,14 +1,19 @@ """Test the National Weather Service (NWS) config flow.""" +import datetime import json from unittest.mock import patch +import pytest import requests_mock from homeassistant import config_entries from homeassistant.components.metoffice.const import DOMAIN +from homeassistant.const import CONF_API_KEY from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType +from homeassistant.helpers import device_registry as dr +from homeassistant.util import utcnow from .const import ( METOFFICE_CONFIG_WAVERTREE, @@ -18,7 +23,7 @@ TEST_SITE_NAME_WAVERTREE, ) -from tests.common import MockConfigEntry, load_fixture +from tests.common import MockConfigEntry, async_fire_time_changed, load_fixture async def test_form(hass: HomeAssistant, requests_mock: requests_mock.Mocker) -> None: @@ -133,3 +138,70 @@ async def test_form_unknown_error( assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} + + +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) +async def test_reauth_flow( + hass: HomeAssistant, + requests_mock: requests_mock.Mocker, + device_registry: dr.DeviceRegistry, +) -> None: + """Test handling authentication errors and reauth flow.""" + mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) + wavertree_daily = json.dumps(mock_json["wavertree_daily"]) + wavertree_hourly = json.dumps(mock_json["wavertree_hourly"]) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=wavertree_hourly, + ) + + entry = MockConfigEntry( + domain=DOMAIN, + data=METOFFICE_CONFIG_WAVERTREE, + ) + entry.add_to_hass(hass) + await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() + + assert len(device_registry.devices) == 1 + + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text="", + status_code=401, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text="", + status_code=401, + ) + + future_time = utcnow() + datetime.timedelta(minutes=40) + async_fire_time_changed(hass, future_time) + await hass.async_block_till_done(wait_background_tasks=True) + + flows = hass.config_entries.flow.async_progress() + assert len(flows) == 1 + assert flows[0]["step_id"] == "reauth_confirm" + + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=wavertree_hourly, + ) + + result3 = await hass.config_entries.flow.async_configure( + flows[0]["flow_id"], + {CONF_API_KEY: TEST_API_KEY}, + ) + await hass.async_block_till_done() + + assert result3["type"] is FlowResultType.ABORT + assert result3["reason"] == "reauth_successful" From c65a693c78c934c93604155bf353f6959740663f Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:04:54 +0000 Subject: [PATCH 03/12] Updated to datapoint 0.11.0 --- .../components/metoffice/config_flow.py | 6 +- homeassistant/components/metoffice/const.py | 35 +-------- homeassistant/components/metoffice/helpers.py | 4 +- .../components/metoffice/manifest.json | 2 +- homeassistant/components/metoffice/sensor.py | 4 +- homeassistant/components/metoffice/weather.py | 27 ++++--- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../metoffice/snapshots/test_weather.ambr | 76 +++++++++---------- 9 files changed, 67 insertions(+), 91 deletions(-) diff --git a/homeassistant/components/metoffice/config_flow.py b/homeassistant/components/metoffice/config_flow.py index 595f47de7b59d..5c7f2517236d7 100644 --- a/homeassistant/components/metoffice/config_flow.py +++ b/homeassistant/components/metoffice/config_flow.py @@ -34,7 +34,11 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, connection = datapoint.Manager.Manager(api_key=api_key) forecast = await hass.async_add_executor_job( - connection.get_forecast, latitude, longitude, "daily" + connection.get_forecast, + latitude, + longitude, + "daily", + False, ) if forecast is None: diff --git a/homeassistant/components/metoffice/const.py b/homeassistant/components/metoffice/const.py index 0699a4f307a32..70ffbfcd56d2d 100644 --- a/homeassistant/components/metoffice/const.py +++ b/homeassistant/components/metoffice/const.py @@ -33,36 +33,7 @@ METOFFICE_MONITORED_CONDITIONS = "metoffice_monitored_conditions" METOFFICE_NAME = "metoffice_name" -# See mapping here: https://github.com/EJEP/datapoint-python/blob/master/src/datapoint/weather_codes.py -HOURLY_CONDITION_CLASSES: dict[str, list[str]] = { - ATTR_CONDITION_CLEAR_NIGHT: ["Clear night"], - ATTR_CONDITION_CLOUDY: ["Cloudy", "Overcast"], - ATTR_CONDITION_FOG: ["Mist", "Fog"], - ATTR_CONDITION_HAIL: ["Hail shower", "Hail"], - ATTR_CONDITION_LIGHTNING: ["Thunder"], - ATTR_CONDITION_LIGHTNING_RAINY: ["Thunder shower"], - ATTR_CONDITION_PARTLYCLOUDY: ["Partly cloudy"], - ATTR_CONDITION_POURING: ["Heavy rain shower", "Heavy rain"], - ATTR_CONDITION_RAINY: ["Light rain shower", "Drizzle", "Light rain"], - ATTR_CONDITION_SNOWY: [ - "Light snow shower", - "Light snow", - "Heavy snow shower", - "Heavy snow", - ], - ATTR_CONDITION_SNOWY_RAINY: ["Sleet shower", "Sleet"], - ATTR_CONDITION_SUNNY: ["Sunny day"], - ATTR_CONDITION_WINDY: [], - ATTR_CONDITION_WINDY_VARIANT: [], - ATTR_CONDITION_EXCEPTIONAL: [], -} -HOURLY_CONDITION_MAP = { - cond_code: cond_ha - for cond_ha, cond_codes in HOURLY_CONDITION_CLASSES.items() - for cond_code in cond_codes -} - -DAILY_CONDITION_CLASSES: dict[str, list[int]] = { +CONDITION_CLASSES: dict[str, list[int]] = { ATTR_CONDITION_CLEAR_NIGHT: [0], ATTR_CONDITION_CLOUDY: [7, 8], ATTR_CONDITION_FOG: [5, 6], @@ -79,8 +50,8 @@ ATTR_CONDITION_WINDY_VARIANT: [], ATTR_CONDITION_EXCEPTIONAL: [], } -DAILY_CONDITION_MAP = { +CONDITION_MAP = { cond_code: cond_ha - for cond_ha, cond_codes in DAILY_CONDITION_CLASSES.items() + for cond_ha, cond_codes in CONDITION_CLASSES.items() for cond_code in cond_codes } diff --git a/homeassistant/components/metoffice/helpers.py b/homeassistant/components/metoffice/helpers.py index 6ffe350d40e5e..39185a09114df 100644 --- a/homeassistant/components/metoffice/helpers.py +++ b/homeassistant/components/metoffice/helpers.py @@ -23,7 +23,9 @@ def fetch_data( ) -> Forecast: """Fetch weather and forecast from Datapoint API.""" try: - return connection.get_forecast(latitude, longitude, frequency) + return connection.get_forecast( + latitude, longitude, frequency, convert_weather_code=False + ) except (ValueError, datapoint.exceptions.APIException) as err: _LOGGER.error("Check Met Office connection: %s", err.args) raise UpdateFailed from err diff --git a/homeassistant/components/metoffice/manifest.json b/homeassistant/components/metoffice/manifest.json index c60d3a789b867..32f5dc10ea2b4 100644 --- a/homeassistant/components/metoffice/manifest.json +++ b/homeassistant/components/metoffice/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/metoffice", "iot_class": "cloud_polling", "loggers": ["datapoint"], - "requirements": ["datapoint==0.10.0"] + "requirements": ["datapoint==0.11.0"] } diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index fda6dc4c0b76f..01eabcb14fef5 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -33,8 +33,8 @@ from . import get_device_info from .const import ( ATTRIBUTION, + CONDITION_MAP, DOMAIN, - HOURLY_CONDITION_MAP, METOFFICE_COORDINATES, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, @@ -218,7 +218,7 @@ def native_value(self) -> StateType: value = get_attribute(self.coordinator.data.now(), self.entity_description.key) if self.entity_description.key == "significantWeatherCode" and value: - value = HOURLY_CONDITION_MAP.get(value) + value = CONDITION_MAP.get(value) return value diff --git a/homeassistant/components/metoffice/weather.py b/homeassistant/components/metoffice/weather.py index 4d3a95e31ce5a..4db96955d654b 100644 --- a/homeassistant/components/metoffice/weather.py +++ b/homeassistant/components/metoffice/weather.py @@ -40,9 +40,8 @@ from . import get_device_info from .const import ( ATTRIBUTION, - DAILY_CONDITION_MAP, + CONDITION_MAP, DOMAIN, - HOURLY_CONDITION_MAP, METOFFICE_COORDINATES, METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, @@ -82,7 +81,7 @@ def _build_hourly_forecast_data(timestep: dict[str, Any]) -> Forecast: data = Forecast(datetime=timestep["time"].isoformat()) weather_code = get_attribute(timestep, "significantWeatherCode") if weather_code: - data[ATTR_FORECAST_CONDITION] = HOURLY_CONDITION_MAP.get(weather_code) + data[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(weather_code) data[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_attribute( timestep, "feelsLikeTemperature" @@ -106,19 +105,23 @@ def _build_hourly_forecast_data(timestep: dict[str, Any]) -> Forecast: def _build_twice_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: data = Forecast(datetime=timestep["time"].isoformat()) data[ATTR_FORECAST_IS_DAYTIME] = abs(timestep["time"].hour - 12) <= 1 - weather_code = get_attribute(timestep, "SignificantWeatherCode") + weather_code = get_attribute(timestep, "significantWeatherCode") if weather_code: - data[ATTR_FORECAST_CONDITION] = DAILY_CONDITION_MAP.get(weather_code) + data[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(weather_code) data[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_attribute( - timestep, "MaxFeelsLikeTemp" - ) - data[ATTR_FORECAST_NATIVE_PRESSURE] = get_attribute(timestep, "Mslp") - data[ATTR_FORECAST_NATIVE_TEMP] = get_attribute(timestep, "UpperBoundMaxTemp") + timestep, "maxFeelsLikeTemp" + ) or get_attribute(timestep, "minFeelsLikeTemp") + data[ATTR_FORECAST_NATIVE_PRESSURE] = get_attribute(timestep, "mslp") + data[ATTR_FORECAST_NATIVE_TEMP] = get_attribute( + timestep, "upperBoundMaxTemp" + ) or get_attribute(timestep, "upperBoundMinTemp") data[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = get_attribute( - timestep, "ProbabilityOfPrecipitation" + timestep, "probabilityOfPrecipitation" ) - data[ATTR_FORECAST_TEMP_LOW] = get_attribute(timestep, "LowerBoundMaxTemp") + data[ATTR_FORECAST_TEMP_LOW] = get_attribute( + timestep, "lowerBoundMaxTemp" + ) or get_attribute(timestep, "lowerBoundMinTemp") data[ATTR_FORECAST_UV_INDEX] = get_attribute(timestep, "maxUvIndex") data[ATTR_FORECAST_WIND_BEARING] = get_attribute(timestep, "10MWindDirection") data[ATTR_FORECAST_NATIVE_WIND_SPEED] = get_attribute(timestep, "10MWindSpeed") @@ -173,7 +176,7 @@ def condition(self) -> str | None: value = get_attribute(weather_now, "significantWeatherCode") if value: - return HOURLY_CONDITION_MAP.get(value) + return CONDITION_MAP.get(value) return None @property diff --git a/requirements_all.txt b/requirements_all.txt index 0451e51ab46b7..33e4ca5f71914 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -723,7 +723,7 @@ crownstone-uart==2.1.0 datadog==0.15.0 # homeassistant.components.metoffice -datapoint==0.10.0 +datapoint==0.11.0 # homeassistant.components.bluetooth dbus-fast==2.24.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 2b0834ee661bc..59baa28d378b2 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -619,7 +619,7 @@ crownstone-uart==2.1.0 datadog==0.15.0 # homeassistant.components.metoffice -datapoint==0.10.0 +datapoint==0.11.0 # homeassistant.components.bluetooth dbus-fast==2.24.3 diff --git a/tests/components/metoffice/snapshots/test_weather.ambr b/tests/components/metoffice/snapshots/test_weather.ambr index 41ccd0b008c54..67f8f1ea52877 100644 --- a/tests/components/metoffice/snapshots/test_weather.ambr +++ b/tests/components/metoffice/snapshots/test_weather.ambr @@ -4,13 +4,14 @@ 'weather.met_office_wavertree': dict({ 'forecast': list([ dict({ + 'apparent_temperature': 4.8, 'condition': 'cloudy', 'datetime': '2024-11-24T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 23, 'pressure': 987.12, - 'temperature': None, - 'templow': None, + 'temperature': 10.7, + 'templow': 7.0, 'uv_index': None, 'wind_bearing': 211, 'wind_gust_speed': 47.2, @@ -31,13 +32,14 @@ 'wind_speed': 23.94, }), dict({ + 'apparent_temperature': 4.2, 'condition': 'partlycloudy', 'datetime': '2024-11-25T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 6, 'pressure': 1004.81, - 'temperature': None, - 'templow': None, + 'temperature': 9.3, + 'templow': 4.4, 'uv_index': None, 'wind_bearing': 262, 'wind_gust_speed': 47.99, @@ -58,13 +60,14 @@ 'wind_speed': 30.67, }), dict({ + 'apparent_temperature': 1.3, 'condition': 'cloudy', 'datetime': '2024-11-26T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 44, 'pressure': 1013.9, - 'temperature': None, - 'templow': None, + 'temperature': 7.5, + 'templow': -0.4, 'uv_index': None, 'wind_bearing': 74, 'wind_gust_speed': 19.51, @@ -85,12 +88,13 @@ 'wind_speed': 20.45, }), dict({ + 'apparent_temperature': 0.2, 'datetime': '2024-11-27T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 9, 'pressure': 1021.75, - 'temperature': None, - 'templow': None, + 'temperature': 7.2, + 'templow': -3.0, 'uv_index': None, 'wind_bearing': 31, 'wind_gust_speed': 19.94, @@ -111,13 +115,14 @@ 'wind_speed': 18.54, }), dict({ + 'apparent_temperature': 1.6, 'condition': 'cloudy', 'datetime': '2024-11-28T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 9, 'pressure': 1023.82, - 'temperature': None, - 'templow': None, + 'temperature': 8.2, + 'templow': -1.9, 'uv_index': None, 'wind_bearing': 131, 'wind_gust_speed': 33.16, @@ -138,13 +143,14 @@ 'wind_speed': 12.64, }), dict({ + 'apparent_temperature': 5.0, 'condition': 'cloudy', 'datetime': '2024-11-29T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 13, 'pressure': 1016.88, - 'temperature': None, - 'templow': None, + 'temperature': 10.8, + 'templow': -1.9, 'uv_index': None, 'wind_bearing': 151, 'wind_gust_speed': 33.16, @@ -694,7 +700,6 @@ }), dict({ 'apparent_temperature': 5.4, - 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -707,7 +712,6 @@ }), dict({ 'apparent_temperature': 5.1, - 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -720,7 +724,6 @@ }), dict({ 'apparent_temperature': 5.0, - 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -733,7 +736,6 @@ }), dict({ 'apparent_temperature': 4.8, - 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -805,13 +807,14 @@ 'weather.met_office_wavertree': dict({ 'forecast': list([ dict({ + 'apparent_temperature': 4.8, 'condition': 'cloudy', 'datetime': '2024-11-24T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 23, 'pressure': 987.12, - 'temperature': None, - 'templow': None, + 'temperature': 10.7, + 'templow': 7.0, 'uv_index': None, 'wind_bearing': 211, 'wind_gust_speed': 47.2, @@ -832,13 +835,14 @@ 'wind_speed': 23.94, }), dict({ + 'apparent_temperature': 4.2, 'condition': 'partlycloudy', 'datetime': '2024-11-25T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 6, 'pressure': 1004.81, - 'temperature': None, - 'templow': None, + 'temperature': 9.3, + 'templow': 4.4, 'uv_index': None, 'wind_bearing': 262, 'wind_gust_speed': 47.99, @@ -859,13 +863,14 @@ 'wind_speed': 30.67, }), dict({ + 'apparent_temperature': 1.3, 'condition': 'cloudy', 'datetime': '2024-11-26T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 44, 'pressure': 1013.9, - 'temperature': None, - 'templow': None, + 'temperature': 7.5, + 'templow': -0.4, 'uv_index': None, 'wind_bearing': 74, 'wind_gust_speed': 19.51, @@ -886,12 +891,13 @@ 'wind_speed': 20.45, }), dict({ + 'apparent_temperature': 0.2, 'datetime': '2024-11-27T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 9, 'pressure': 1021.75, - 'temperature': None, - 'templow': None, + 'temperature': 7.2, + 'templow': -3.0, 'uv_index': None, 'wind_bearing': 31, 'wind_gust_speed': 19.94, @@ -912,13 +918,14 @@ 'wind_speed': 18.54, }), dict({ + 'apparent_temperature': 1.6, 'condition': 'cloudy', 'datetime': '2024-11-28T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 9, 'pressure': 1023.82, - 'temperature': None, - 'templow': None, + 'temperature': 8.2, + 'templow': -1.9, 'uv_index': None, 'wind_bearing': 131, 'wind_gust_speed': 33.16, @@ -939,13 +946,14 @@ 'wind_speed': 12.64, }), dict({ + 'apparent_temperature': 5.0, 'condition': 'cloudy', 'datetime': '2024-11-29T00:00:00+00:00', 'is_daytime': False, 'precipitation_probability': 13, 'pressure': 1016.88, - 'temperature': None, - 'templow': None, + 'temperature': 10.8, + 'templow': -1.9, 'uv_index': None, 'wind_bearing': 151, 'wind_gust_speed': 33.16, @@ -1495,7 +1503,6 @@ }), dict({ 'apparent_temperature': 5.4, - 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -1508,7 +1515,6 @@ }), dict({ 'apparent_temperature': 5.1, - 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -1521,7 +1527,6 @@ }), dict({ 'apparent_temperature': 5.0, - 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -1534,7 +1539,6 @@ }), dict({ 'apparent_temperature': 4.8, - 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2125,7 +2129,6 @@ }), dict({ 'apparent_temperature': 5.4, - 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2138,7 +2141,6 @@ }), dict({ 'apparent_temperature': 5.1, - 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2151,7 +2153,6 @@ }), dict({ 'apparent_temperature': 5.0, - 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2164,7 +2165,6 @@ }), dict({ 'apparent_temperature': 4.8, - 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2753,7 +2753,6 @@ }), dict({ 'apparent_temperature': 5.4, - 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2766,7 +2765,6 @@ }), dict({ 'apparent_temperature': 5.1, - 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2779,7 +2777,6 @@ }), dict({ 'apparent_temperature': 5.0, - 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2792,7 +2789,6 @@ }), dict({ 'apparent_temperature': 4.8, - 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, From 237dcf952dcec15bbeb1f79b73130652d5012607 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:11:10 +0000 Subject: [PATCH 04/12] Less hacky check for day/night in twice-daily forecasts --- homeassistant/components/metoffice/weather.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/metoffice/weather.py b/homeassistant/components/metoffice/weather.py index 4db96955d654b..37e21a4188403 100644 --- a/homeassistant/components/metoffice/weather.py +++ b/homeassistant/components/metoffice/weather.py @@ -104,7 +104,9 @@ def _build_hourly_forecast_data(timestep: dict[str, Any]) -> Forecast: def _build_twice_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: data = Forecast(datetime=timestep["time"].isoformat()) - data[ATTR_FORECAST_IS_DAYTIME] = abs(timestep["time"].hour - 12) <= 1 + + # day and night forecasts have slightly different format + data[ATTR_FORECAST_IS_DAYTIME] = "upperBoundMaxTemp" in timestep weather_code = get_attribute(timestep, "significantWeatherCode") if weather_code: data[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(weather_code) From 1c9d44bb7f30562b8a4f00778c3fc4d6ff3ac6a0 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Fri, 29 Nov 2024 00:36:27 +0000 Subject: [PATCH 05/12] Updated to datapoint 0.12.1, added daily forecast --- .../components/metoffice/__init__.py | 17 ++ homeassistant/components/metoffice/const.py | 63 +++++ homeassistant/components/metoffice/helpers.py | 2 +- .../components/metoffice/manifest.json | 2 +- homeassistant/components/metoffice/weather.py | 127 ++++++---- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../metoffice/snapshots/test_weather.ambr | 232 +++++++++++++++++- tests/components/metoffice/test_weather.py | 6 +- 9 files changed, 398 insertions(+), 55 deletions(-) diff --git a/homeassistant/components/metoffice/__init__.py b/homeassistant/components/metoffice/__init__.py index a0b85877a60e2..0dd207511d5cf 100644 --- a/homeassistant/components/metoffice/__init__.py +++ b/homeassistant/components/metoffice/__init__.py @@ -31,6 +31,7 @@ METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, + METOFFICE_TWICE_DAILY_COORDINATOR, ) from .helpers import fetch_data @@ -92,6 +93,11 @@ async def async_update_daily() -> datapoint.Forecast: fetch_data, connection, latitude, longitude, "daily" ) + async def async_update_twice_daily() -> datapoint.Forecast: + return await hass.async_add_executor_job( + fetch_data, connection, latitude, longitude, "twice-daily" + ) + async def async_update_hourly() -> datapoint.Forecast: return await hass.async_add_executor_job( fetch_data, connection, latitude, longitude, "hourly" @@ -106,6 +112,15 @@ async def async_update_hourly() -> datapoint.Forecast: update_interval=DEFAULT_SCAN_INTERVAL, ) + metoffice_twice_daily_coordinator = TimestampDataUpdateCoordinator( + hass, + _LOGGER, + config_entry=entry, + name=f"MetOffice Twice Daily Coordinator for {site_name}", + update_method=async_update_twice_daily, + update_interval=DEFAULT_SCAN_INTERVAL, + ) + metoffice_hourly_coordinator = TimestampDataUpdateCoordinator( hass, _LOGGER, @@ -118,6 +133,7 @@ async def async_update_hourly() -> datapoint.Forecast: metoffice_hass_data = hass.data.setdefault(DOMAIN, {}) metoffice_hass_data[entry.entry_id] = { METOFFICE_DAILY_COORDINATOR: metoffice_daily_coordinator, + METOFFICE_TWICE_DAILY_COORDINATOR: metoffice_twice_daily_coordinator, METOFFICE_HOURLY_COORDINATOR: metoffice_hourly_coordinator, METOFFICE_NAME: site_name, METOFFICE_COORDINATES: coordinates, @@ -126,6 +142,7 @@ async def async_update_hourly() -> datapoint.Forecast: # Fetch initial data so we have data when entities subscribe await asyncio.gather( metoffice_daily_coordinator.async_config_entry_first_refresh(), + metoffice_twice_daily_coordinator.async_config_entry_first_refresh(), metoffice_hourly_coordinator.async_config_entry_first_refresh(), ) diff --git a/homeassistant/components/metoffice/const.py b/homeassistant/components/metoffice/const.py index 70ffbfcd56d2d..c0133b2c3bd3c 100644 --- a/homeassistant/components/metoffice/const.py +++ b/homeassistant/components/metoffice/const.py @@ -18,6 +18,17 @@ ATTR_CONDITION_SUNNY, ATTR_CONDITION_WINDY, ATTR_CONDITION_WINDY_VARIANT, + ATTR_FORECAST_CONDITION, + ATTR_FORECAST_NATIVE_APPARENT_TEMP, + ATTR_FORECAST_NATIVE_PRESSURE, + ATTR_FORECAST_NATIVE_TEMP, + ATTR_FORECAST_NATIVE_TEMP_LOW, + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED, + ATTR_FORECAST_NATIVE_WIND_SPEED, + ATTR_FORECAST_PRECIPITATION, + ATTR_FORECAST_PRECIPITATION_PROBABILITY, + ATTR_FORECAST_UV_INDEX, + ATTR_FORECAST_WIND_BEARING, ) DOMAIN = "metoffice" @@ -29,6 +40,7 @@ METOFFICE_COORDINATES = "metoffice_coordinates" METOFFICE_HOURLY_COORDINATOR = "metoffice_hourly_coordinator" +METOFFICE_TWICE_DAILY_COORDINATOR = "metoffice_twice_daily_coordinator" METOFFICE_DAILY_COORDINATOR = "metoffice_daily_coordinator" METOFFICE_MONITORED_CONDITIONS = "metoffice_monitored_conditions" METOFFICE_NAME = "metoffice_name" @@ -55,3 +67,54 @@ for cond_ha, cond_codes in CONDITION_CLASSES.items() for cond_code in cond_codes } + +HOURLY_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { + ATTR_FORECAST_CONDITION: "significantWeatherCode", + ATTR_FORECAST_NATIVE_APPARENT_TEMP: "feelsLikeTemperature", + ATTR_FORECAST_NATIVE_PRESSURE: "mslp", + ATTR_FORECAST_NATIVE_TEMP: "screenTemperature", + ATTR_FORECAST_PRECIPITATION: "totalPrecipAmount", + ATTR_FORECAST_PRECIPITATION_PROBABILITY: "probOfPrecipitation", + ATTR_FORECAST_UV_INDEX: "uvIndex", + ATTR_FORECAST_WIND_BEARING: "windDirectionFrom10m", + ATTR_FORECAST_NATIVE_WIND_SPEED: "windSpeed10m", + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "windGustSpeed10m", +} + +DAY_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { + ATTR_FORECAST_CONDITION: "daySignificantWeatherCode", + ATTR_FORECAST_NATIVE_APPARENT_TEMP: "dayMaxFeelsLikeTemp", + ATTR_FORECAST_NATIVE_PRESSURE: "middayMslp", + ATTR_FORECAST_NATIVE_TEMP: "dayUpperBoundMaxTemp", + ATTR_FORECAST_NATIVE_TEMP_LOW: "dayLowerBoundMaxTemp", + ATTR_FORECAST_PRECIPITATION_PROBABILITY: "dayProbabilityOfPrecipitation", + ATTR_FORECAST_UV_INDEX: "maxUvIndex", + ATTR_FORECAST_WIND_BEARING: "midday10MWindDirection", + ATTR_FORECAST_NATIVE_WIND_SPEED: "midday10MWindSpeed", + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "midday10MWindGust", +} + +NIGHT_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { + ATTR_FORECAST_CONDITION: "nightSignificantWeatherCode", + ATTR_FORECAST_NATIVE_APPARENT_TEMP: "nightMinFeelsLikeTemp", + ATTR_FORECAST_NATIVE_PRESSURE: "midnightMslp", + ATTR_FORECAST_NATIVE_TEMP: "nightUpperBoundMinTemp", + ATTR_FORECAST_NATIVE_TEMP_LOW: "nightLowerBoundMinTemp", + ATTR_FORECAST_PRECIPITATION_PROBABILITY: "nightProbabilityOfPrecipitation", + ATTR_FORECAST_WIND_BEARING: "midnight10MWindDirection", + ATTR_FORECAST_NATIVE_WIND_SPEED: "midnight10MWindSpeed", + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "midnight10MWindGust", +} + +DAILY_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { + ATTR_FORECAST_CONDITION: "daySignificantWeatherCode", + ATTR_FORECAST_NATIVE_APPARENT_TEMP: "dayMaxFeelsLikeTemp", + ATTR_FORECAST_NATIVE_PRESSURE: "middayMslp", + ATTR_FORECAST_NATIVE_TEMP: "dayMaxScreenTemperature", + ATTR_FORECAST_NATIVE_TEMP_LOW: "nightMinScreenTemperature", + ATTR_FORECAST_PRECIPITATION_PROBABILITY: "dayProbabilityOfPrecipitation", + ATTR_FORECAST_UV_INDEX: "maxUvIndex", + ATTR_FORECAST_WIND_BEARING: "midday10MWindDirection", + ATTR_FORECAST_NATIVE_WIND_SPEED: "midday10MWindSpeed", + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "midday10MWindGust", +} diff --git a/homeassistant/components/metoffice/helpers.py b/homeassistant/components/metoffice/helpers.py index 39185a09114df..e6bb8a34020a0 100644 --- a/homeassistant/components/metoffice/helpers.py +++ b/homeassistant/components/metoffice/helpers.py @@ -19,7 +19,7 @@ def fetch_data( connection: datapoint.Manager, latitude: float, longitude: float, - frequency: Literal["daily", "hourly"], + frequency: Literal["daily", "twice-daily", "hourly"], ) -> Forecast: """Fetch weather and forecast from Datapoint API.""" try: diff --git a/homeassistant/components/metoffice/manifest.json b/homeassistant/components/metoffice/manifest.json index 32f5dc10ea2b4..730c75223fd9e 100644 --- a/homeassistant/components/metoffice/manifest.json +++ b/homeassistant/components/metoffice/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/metoffice", "iot_class": "cloud_polling", "loggers": ["datapoint"], - "requirements": ["datapoint==0.11.0"] + "requirements": ["datapoint==0.12.1"] } diff --git a/homeassistant/components/metoffice/weather.py b/homeassistant/components/metoffice/weather.py index 37e21a4188403..08d9f7de815f4 100644 --- a/homeassistant/components/metoffice/weather.py +++ b/homeassistant/components/metoffice/weather.py @@ -13,11 +13,11 @@ ATTR_FORECAST_NATIVE_APPARENT_TEMP, ATTR_FORECAST_NATIVE_PRESSURE, ATTR_FORECAST_NATIVE_TEMP, + ATTR_FORECAST_NATIVE_TEMP_LOW, ATTR_FORECAST_NATIVE_WIND_GUST_SPEED, ATTR_FORECAST_NATIVE_WIND_SPEED, ATTR_FORECAST_PRECIPITATION, ATTR_FORECAST_PRECIPITATION_PROBABILITY, - ATTR_FORECAST_TEMP_LOW, ATTR_FORECAST_UV_INDEX, ATTR_FORECAST_WIND_BEARING, DOMAIN as WEATHER_DOMAIN, @@ -41,11 +41,16 @@ from .const import ( ATTRIBUTION, CONDITION_MAP, + DAILY_FORECAST_ATTRIBUTE_MAP, + DAY_FORECAST_ATTRIBUTE_MAP, DOMAIN, + HOURLY_FORECAST_ATTRIBUTE_MAP, METOFFICE_COORDINATES, METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, + METOFFICE_TWICE_DAILY_COORDINATOR, + NIGHT_FORECAST_ATTRIBUTE_MAP, ) from .helpers import get_attribute @@ -69,6 +74,7 @@ async def async_setup_entry( [ MetOfficeWeather( hass_data[METOFFICE_DAILY_COORDINATOR], + hass_data[METOFFICE_TWICE_DAILY_COORDINATOR], hass_data[METOFFICE_HOURLY_COORDINATOR], hass_data, ) @@ -79,26 +85,7 @@ async def async_setup_entry( def _build_hourly_forecast_data(timestep: dict[str, Any]) -> Forecast: data = Forecast(datetime=timestep["time"].isoformat()) - weather_code = get_attribute(timestep, "significantWeatherCode") - if weather_code: - data[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(weather_code) - - data[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_attribute( - timestep, "feelsLikeTemperature" - ) - data[ATTR_FORECAST_NATIVE_PRESSURE] = get_attribute(timestep, "mslp") - data[ATTR_FORECAST_NATIVE_TEMP] = get_attribute(timestep, "screenTemperature") - data[ATTR_FORECAST_PRECIPITATION] = get_attribute(timestep, "totalPrecipAmount") - data[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = get_attribute( - timestep, "probOfPrecipitation" - ) - data[ATTR_FORECAST_UV_INDEX] = get_attribute(timestep, "uvIndex") - data[ATTR_FORECAST_WIND_BEARING] = get_attribute(timestep, "windDirectionFrom10m") - data[ATTR_FORECAST_NATIVE_WIND_SPEED] = get_attribute(timestep, "windSpeed10m") - data[ATTR_FORECAST_NATIVE_WIND_GUST_SPEED] = get_attribute( - timestep, "windGustSpeed10m" - ) - + _populate_forecast_data(data, timestep, HOURLY_FORECAST_ATTRIBUTE_MAP) return data @@ -106,35 +93,67 @@ def _build_twice_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: data = Forecast(datetime=timestep["time"].isoformat()) # day and night forecasts have slightly different format - data[ATTR_FORECAST_IS_DAYTIME] = "upperBoundMaxTemp" in timestep - weather_code = get_attribute(timestep, "significantWeatherCode") - if weather_code: - data[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(weather_code) - - data[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_attribute( - timestep, "maxFeelsLikeTemp" - ) or get_attribute(timestep, "minFeelsLikeTemp") - data[ATTR_FORECAST_NATIVE_PRESSURE] = get_attribute(timestep, "mslp") - data[ATTR_FORECAST_NATIVE_TEMP] = get_attribute( - timestep, "upperBoundMaxTemp" - ) or get_attribute(timestep, "upperBoundMinTemp") - data[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = get_attribute( - timestep, "probabilityOfPrecipitation" - ) - data[ATTR_FORECAST_TEMP_LOW] = get_attribute( - timestep, "lowerBoundMaxTemp" - ) or get_attribute(timestep, "lowerBoundMinTemp") - data[ATTR_FORECAST_UV_INDEX] = get_attribute(timestep, "maxUvIndex") - data[ATTR_FORECAST_WIND_BEARING] = get_attribute(timestep, "10MWindDirection") - data[ATTR_FORECAST_NATIVE_WIND_SPEED] = get_attribute(timestep, "10MWindSpeed") - data[ATTR_FORECAST_NATIVE_WIND_GUST_SPEED] = get_attribute(timestep, "10MWindGust") + if "daySignificantWeatherCode" in timestep: + data[ATTR_FORECAST_IS_DAYTIME] = True + _populate_forecast_data(data, timestep, DAY_FORECAST_ATTRIBUTE_MAP) + else: + data[ATTR_FORECAST_IS_DAYTIME] = False + _populate_forecast_data(data, timestep, NIGHT_FORECAST_ATTRIBUTE_MAP) + return data + + +def _build_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: + data = Forecast(datetime=timestep["time"].isoformat()) + _populate_forecast_data(data, timestep, DAILY_FORECAST_ATTRIBUTE_MAP) return data +def _populate_forecast_data( + forecast: Forecast, timestep: dict[str, Any], mapping: dict[str, str] +) -> None: + def get_mapped_attribute(attr: str) -> Any: + if attr not in mapping: + return None + return get_attribute(timestep, mapping[attr]) + + weather_code = get_mapped_attribute(ATTR_FORECAST_CONDITION) + if weather_code is not None: + forecast[ATTR_FORECAST_CONDITION] = CONDITION_MAP.get(weather_code) + forecast[ATTR_FORECAST_NATIVE_APPARENT_TEMP] = get_mapped_attribute( + ATTR_FORECAST_NATIVE_APPARENT_TEMP + ) + forecast[ATTR_FORECAST_NATIVE_PRESSURE] = get_mapped_attribute( + ATTR_FORECAST_NATIVE_PRESSURE + ) + forecast[ATTR_FORECAST_NATIVE_TEMP] = get_mapped_attribute( + ATTR_FORECAST_NATIVE_TEMP + ) + forecast[ATTR_FORECAST_NATIVE_TEMP_LOW] = get_mapped_attribute( + ATTR_FORECAST_NATIVE_TEMP_LOW + ) + forecast[ATTR_FORECAST_PRECIPITATION] = get_mapped_attribute( + ATTR_FORECAST_PRECIPITATION + ) + forecast[ATTR_FORECAST_PRECIPITATION_PROBABILITY] = get_mapped_attribute( + ATTR_FORECAST_PRECIPITATION_PROBABILITY + ) + forecast[ATTR_FORECAST_UV_INDEX] = get_mapped_attribute(ATTR_FORECAST_UV_INDEX) + forecast[ATTR_FORECAST_WIND_BEARING] = get_mapped_attribute( + ATTR_FORECAST_WIND_BEARING + ) + forecast[ATTR_FORECAST_NATIVE_WIND_SPEED] = get_mapped_attribute( + ATTR_FORECAST_NATIVE_WIND_SPEED + ) + forecast[ATTR_FORECAST_NATIVE_WIND_GUST_SPEED] = get_mapped_attribute( + ATTR_FORECAST_NATIVE_WIND_GUST_SPEED + ) + + class MetOfficeWeather( CoordinatorWeatherEntity[ TimestampDataUpdateCoordinator[ForecastData], TimestampDataUpdateCoordinator[ForecastData], + TimestampDataUpdateCoordinator[ForecastData], ] ): """Implementation of a Met Office weather condition.""" @@ -149,12 +168,15 @@ class MetOfficeWeather( _attr_native_visibility_unit = UnitOfLength.METERS _attr_native_wind_speed_unit = UnitOfSpeed.METERS_PER_SECOND _attr_supported_features = ( - WeatherEntityFeature.FORECAST_HOURLY | WeatherEntityFeature.FORECAST_TWICE_DAILY + WeatherEntityFeature.FORECAST_HOURLY + | WeatherEntityFeature.FORECAST_TWICE_DAILY + | WeatherEntityFeature.FORECAST_DAILY ) def __init__( self, coordinator_daily: TimestampDataUpdateCoordinator[ForecastData], + coordinator_twice_daily: TimestampDataUpdateCoordinator[ForecastData], coordinator_hourly: TimestampDataUpdateCoordinator[ForecastData], hass_data: dict[str, Any], ) -> None: @@ -163,6 +185,7 @@ def __init__( super().__init__( observation_coordinator, daily_coordinator=coordinator_daily, + twice_daily_coordinator=coordinator_twice_daily, hourly_coordinator=coordinator_hourly, ) @@ -237,12 +260,26 @@ def wind_bearing(self) -> float | None: value = get_attribute(weather_now, "windDirectionFrom10m") return float(value) if value is not None else None + @callback + def _async_forecast_daily(self) -> list[Forecast] | None: + """Return the daily forecast in native units.""" + coordinator = cast( + TimestampDataUpdateCoordinator[ForecastData], + self.forecast_coordinators["daily"], + ) + timesteps = coordinator.data.timesteps + return [ + _build_daily_forecast_data(timestep) + for timestep in timesteps + if timestep["time"] > datetime.now(tz=timesteps[0]["time"].tzinfo) + ] + @callback def _async_forecast_twice_daily(self) -> list[Forecast] | None: """Return the twice daily forecast in native units.""" coordinator = cast( TimestampDataUpdateCoordinator[ForecastData], - self.forecast_coordinators["daily"], + self.forecast_coordinators["twice_daily"], ) timesteps = coordinator.data.timesteps return [ diff --git a/requirements_all.txt b/requirements_all.txt index 929af8ad7ab70..12aae5d530453 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -723,7 +723,7 @@ crownstone-uart==2.1.0 datadog==0.15.0 # homeassistant.components.metoffice -datapoint==0.11.0 +datapoint==0.12.1 # homeassistant.components.bluetooth dbus-fast==2.24.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 1b00675527b03..b39850d0c37d2 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -619,7 +619,7 @@ crownstone-uart==2.1.0 datadog==0.15.0 # homeassistant.components.metoffice -datapoint==0.11.0 +datapoint==0.12.1 # homeassistant.components.bluetooth dbus-fast==2.24.3 diff --git a/tests/components/metoffice/snapshots/test_weather.ambr b/tests/components/metoffice/snapshots/test_weather.ambr index 67f8f1ea52877..414b0eed76d7c 100644 --- a/tests/components/metoffice/snapshots/test_weather.ambr +++ b/tests/components/metoffice/snapshots/test_weather.ambr @@ -1,5 +1,97 @@ # serializer version: 1 # name: test_forecast_service[get_forecasts] + dict({ + 'weather.met_office_wavertree': dict({ + 'forecast': list([ + dict({ + 'apparent_temperature': 9.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 26, + 'pressure': 987.48, + 'temperature': 12.7, + 'templow': 8.2, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, + }), + dict({ + 'apparent_temperature': 5.3, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 5, + 'pressure': 994.88, + 'temperature': 9.8, + 'templow': 7.7, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, + }), + dict({ + 'apparent_temperature': 5.9, + 'condition': 'partlycloudy', + 'datetime': '2024-11-26T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 6, + 'pressure': 1012.93, + 'temperature': 8.7, + 'templow': 3.8, + 'uv_index': 1, + 'wind_bearing': 265, + 'wind_gust_speed': 34.49, + 'wind_speed': 20.45, + }), + dict({ + 'apparent_temperature': 3.3, + 'condition': 'rainy', + 'datetime': '2024-11-27T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 43, + 'pressure': 1014.39, + 'temperature': 6.7, + 'templow': 2.4, + 'uv_index': 1, + 'wind_bearing': 8, + 'wind_gust_speed': 32.18, + 'wind_speed': 18.54, + }), + dict({ + 'apparent_temperature': 3.0, + 'condition': 'cloudy', + 'datetime': '2024-11-28T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 9, + 'pressure': 1025.12, + 'temperature': 5.7, + 'templow': 3.8, + 'uv_index': 1, + 'wind_bearing': 104, + 'wind_gust_speed': 22.36, + 'wind_speed': 12.64, + }), + dict({ + 'apparent_temperature': 4.9, + 'condition': 'cloudy', + 'datetime': '2024-11-29T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 11, + 'pressure': 1019.85, + 'temperature': 8.2, + 'templow': 7.0, + 'uv_index': 1, + 'wind_bearing': 137, + 'wind_gust_speed': 38.59, + 'wind_speed': 23.0, + }), + ]), + }), + }) +# --- +# name: test_forecast_service[get_forecasts].1 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ @@ -8,6 +100,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-24T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 23, 'pressure': 987.12, 'temperature': 10.7, @@ -22,6 +115,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-24T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 26, 'pressure': 987.48, 'temperature': 15.2, @@ -36,6 +130,7 @@ 'condition': 'partlycloudy', 'datetime': '2024-11-25T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 6, 'pressure': 1004.81, 'temperature': 9.3, @@ -50,6 +145,7 @@ 'condition': 'partlycloudy', 'datetime': '2024-11-25T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 5, 'pressure': 994.88, 'temperature': 11.0, @@ -64,6 +160,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-26T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 44, 'pressure': 1013.9, 'temperature': 7.5, @@ -78,6 +175,7 @@ 'condition': 'partlycloudy', 'datetime': '2024-11-26T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 6, 'pressure': 1012.93, 'temperature': 10.1, @@ -89,8 +187,10 @@ }), dict({ 'apparent_temperature': 0.2, + 'condition': 'clear-night', 'datetime': '2024-11-27T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 9, 'pressure': 1021.75, 'temperature': 7.2, @@ -105,6 +205,7 @@ 'condition': 'rainy', 'datetime': '2024-11-27T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 43, 'pressure': 1014.39, 'temperature': 11.1, @@ -119,6 +220,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-28T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 9, 'pressure': 1023.82, 'temperature': 8.2, @@ -133,6 +235,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-28T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 9, 'pressure': 1025.12, 'temperature': 9.4, @@ -147,6 +250,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-29T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 13, 'pressure': 1016.88, 'temperature': 10.8, @@ -161,6 +265,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-29T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 11, 'pressure': 1019.85, 'temperature': 12.6, @@ -174,7 +279,7 @@ }), }) # --- -# name: test_forecast_service[get_forecasts].1 +# name: test_forecast_service[get_forecasts].2 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ @@ -700,6 +805,7 @@ }), dict({ 'apparent_temperature': 5.4, + 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -712,6 +818,7 @@ }), dict({ 'apparent_temperature': 5.1, + 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -724,6 +831,7 @@ }), dict({ 'apparent_temperature': 5.0, + 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -736,6 +844,7 @@ }), dict({ 'apparent_temperature': 4.8, + 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -802,7 +911,99 @@ }), }) # --- -# name: test_forecast_service[get_forecasts].2 +# name: test_forecast_service[get_forecasts].3 + dict({ + 'weather.met_office_wavertree': dict({ + 'forecast': list([ + dict({ + 'apparent_temperature': 9.2, + 'condition': 'cloudy', + 'datetime': '2024-11-24T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 26, + 'pressure': 987.48, + 'temperature': 12.7, + 'templow': 8.2, + 'uv_index': 1, + 'wind_bearing': 203, + 'wind_gust_speed': 42.66, + 'wind_speed': 23.94, + }), + dict({ + 'apparent_temperature': 5.3, + 'condition': 'partlycloudy', + 'datetime': '2024-11-25T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 5, + 'pressure': 994.88, + 'temperature': 9.8, + 'templow': 7.7, + 'uv_index': 1, + 'wind_bearing': 251, + 'wind_gust_speed': 52.16, + 'wind_speed': 30.67, + }), + dict({ + 'apparent_temperature': 5.9, + 'condition': 'partlycloudy', + 'datetime': '2024-11-26T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 6, + 'pressure': 1012.93, + 'temperature': 8.7, + 'templow': 3.8, + 'uv_index': 1, + 'wind_bearing': 265, + 'wind_gust_speed': 34.49, + 'wind_speed': 20.45, + }), + dict({ + 'apparent_temperature': 3.3, + 'condition': 'rainy', + 'datetime': '2024-11-27T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 43, + 'pressure': 1014.39, + 'temperature': 6.7, + 'templow': 2.4, + 'uv_index': 1, + 'wind_bearing': 8, + 'wind_gust_speed': 32.18, + 'wind_speed': 18.54, + }), + dict({ + 'apparent_temperature': 3.0, + 'condition': 'cloudy', + 'datetime': '2024-11-28T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 9, + 'pressure': 1025.12, + 'temperature': 5.7, + 'templow': 3.8, + 'uv_index': 1, + 'wind_bearing': 104, + 'wind_gust_speed': 22.36, + 'wind_speed': 12.64, + }), + dict({ + 'apparent_temperature': 4.9, + 'condition': 'cloudy', + 'datetime': '2024-11-29T00:00:00+00:00', + 'precipitation': None, + 'precipitation_probability': 11, + 'pressure': 1019.85, + 'temperature': 8.2, + 'templow': 7.0, + 'uv_index': 1, + 'wind_bearing': 137, + 'wind_gust_speed': 38.59, + 'wind_speed': 23.0, + }), + ]), + }), + }) +# --- +# name: test_forecast_service[get_forecasts].4 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ @@ -811,6 +1012,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-24T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 23, 'pressure': 987.12, 'temperature': 10.7, @@ -825,6 +1027,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-24T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 26, 'pressure': 987.48, 'temperature': 15.2, @@ -839,6 +1042,7 @@ 'condition': 'partlycloudy', 'datetime': '2024-11-25T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 6, 'pressure': 1004.81, 'temperature': 9.3, @@ -853,6 +1057,7 @@ 'condition': 'partlycloudy', 'datetime': '2024-11-25T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 5, 'pressure': 994.88, 'temperature': 11.0, @@ -867,6 +1072,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-26T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 44, 'pressure': 1013.9, 'temperature': 7.5, @@ -881,6 +1087,7 @@ 'condition': 'partlycloudy', 'datetime': '2024-11-26T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 6, 'pressure': 1012.93, 'temperature': 10.1, @@ -892,8 +1099,10 @@ }), dict({ 'apparent_temperature': 0.2, + 'condition': 'clear-night', 'datetime': '2024-11-27T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 9, 'pressure': 1021.75, 'temperature': 7.2, @@ -908,6 +1117,7 @@ 'condition': 'rainy', 'datetime': '2024-11-27T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 43, 'pressure': 1014.39, 'temperature': 11.1, @@ -922,6 +1132,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-28T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 9, 'pressure': 1023.82, 'temperature': 8.2, @@ -936,6 +1147,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-28T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 9, 'pressure': 1025.12, 'temperature': 9.4, @@ -950,6 +1162,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-29T00:00:00+00:00', 'is_daytime': False, + 'precipitation': None, 'precipitation_probability': 13, 'pressure': 1016.88, 'temperature': 10.8, @@ -964,6 +1177,7 @@ 'condition': 'cloudy', 'datetime': '2024-11-29T12:00:00+00:00', 'is_daytime': True, + 'precipitation': None, 'precipitation_probability': 11, 'pressure': 1019.85, 'temperature': 12.6, @@ -977,7 +1191,7 @@ }), }) # --- -# name: test_forecast_service[get_forecasts].3 +# name: test_forecast_service[get_forecasts].5 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ @@ -1503,6 +1717,7 @@ }), dict({ 'apparent_temperature': 5.4, + 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -1515,6 +1730,7 @@ }), dict({ 'apparent_temperature': 5.1, + 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -1527,6 +1743,7 @@ }), dict({ 'apparent_temperature': 5.0, + 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -1539,6 +1756,7 @@ }), dict({ 'apparent_temperature': 4.8, + 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2129,6 +2347,7 @@ }), dict({ 'apparent_temperature': 5.4, + 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2141,6 +2360,7 @@ }), dict({ 'apparent_temperature': 5.1, + 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2153,6 +2373,7 @@ }), dict({ 'apparent_temperature': 5.0, + 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2165,6 +2386,7 @@ }), dict({ 'apparent_temperature': 4.8, + 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2753,6 +2975,7 @@ }), dict({ 'apparent_temperature': 5.4, + 'condition': 'clear-night', 'datetime': '2024-11-25T05:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2765,6 +2988,7 @@ }), dict({ 'apparent_temperature': 5.1, + 'condition': 'clear-night', 'datetime': '2024-11-25T06:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2777,6 +3001,7 @@ }), dict({ 'apparent_temperature': 5.0, + 'condition': 'clear-night', 'datetime': '2024-11-25T07:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, @@ -2789,6 +3014,7 @@ }), dict({ 'apparent_temperature': 4.8, + 'condition': 'clear-night', 'datetime': '2024-11-25T08:00:00+00:00', 'precipitation': 0.0, 'precipitation_probability': 1, diff --git a/tests/components/metoffice/test_weather.py b/tests/components/metoffice/test_weather.py index 63350fb8c73e3..6380ba38af336 100644 --- a/tests/components/metoffice/test_weather.py +++ b/tests/components/metoffice/test_weather.py @@ -282,10 +282,10 @@ async def test_forecast_service( await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() - assert wavertree_data["wavertree_daily_mock"].call_count == 1 + assert wavertree_data["wavertree_daily_mock"].call_count == 2 assert wavertree_data["wavertree_hourly_mock"].call_count == 1 - for forecast_type in ("twice_daily", "hourly"): + for forecast_type in ("daily", "twice_daily", "hourly"): response = await hass.services.async_call( WEATHER_DOMAIN, service, @@ -303,7 +303,7 @@ async def test_forecast_service( async_fire_time_changed(hass) await hass.async_block_till_done(wait_background_tasks=True) - for forecast_type in ("twice_daily", "hourly"): + for forecast_type in ("daily", "twice_daily", "hourly"): response = await hass.services.async_call( WEATHER_DOMAIN, service, From 5432992315d1fcf495e8ecb3a0b49449b24c0414 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:30:29 +0000 Subject: [PATCH 06/12] addressed review comments --- .../components/metoffice/__init__.py | 42 +------ homeassistant/components/metoffice/sensor.py | 82 ++++++++----- .../components/metoffice/strings.json | 1 + tests/components/metoffice/const.py | 24 ++-- tests/components/metoffice/test_init.py | 111 ------------------ 5 files changed, 69 insertions(+), 191 deletions(-) diff --git a/homeassistant/components/metoffice/__init__.py b/homeassistant/components/metoffice/__init__.py index 0dd207511d5cf..a8f92b2b31d94 100644 --- a/homeassistant/components/metoffice/__init__.py +++ b/homeassistant/components/metoffice/__init__.py @@ -4,8 +4,6 @@ import asyncio import logging -import re -from typing import Any import datapoint import datapoint.Forecast @@ -19,8 +17,8 @@ CONF_NAME, Platform, ) -from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers import device_registry as dr, entity_registry as er +from homeassistant.core import HomeAssistant +from homeassistant.helpers import device_registry as dr from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import TimestampDataUpdateCoordinator @@ -50,42 +48,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: coordinates = f"{latitude}_{longitude}" - @callback - def update_unique_id( - entity_entry: er.RegistryEntry, - ) -> dict[str, Any] | None: - """Update unique ID of entity entry.""" - - if entity_entry.domain != Platform.SENSOR: - return None - - key_mapping = { - "weather": "significantWeatherCode", - "temperature": "screenTemperature", - "feels_like_temperature": "feelsLikeTemperature", - "wind_speed": "windSpeed10m", - "wind_direction": "windDirectionFrom10m", - "wind_gust": "windGustSpeed10m", - "uv": "uvIndex", - "precipitation": "probOfPrecipitation", - "humidity": "screenRelativeHumidity", - } - - match = re.search(f"(?P.*)_{coordinates}.*", entity_entry.unique_id) - - if match is None: - return None - - if (old_key := match.group("key")) in key_mapping: - return { - "new_unique_id": entity_entry.unique_id.replace( - old_key, key_mapping[old_key] - ) - } - return None - - await er.async_migrate_entries(hass, entry.entry_id, update_unique_id) - connection = datapoint.Manager.Manager(api_key=api_key) async def async_update_daily() -> datapoint.Forecast: diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index 01eabcb14fef5..e6f726265fe5b 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -2,6 +2,7 @@ from __future__ import annotations +from dataclasses import dataclass from typing import Any from datapoint.Forecast import Forecast @@ -46,45 +47,58 @@ ATTR_SITE_NAME = "site_name" -SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( - SensorEntityDescription( +@dataclass(frozen=True, kw_only=True) +class MetOfficeSensorEntityDescription(SensorEntityDescription): + """Entity description class for MetOffice sensors.""" + + native_attr_name: str + + +SENSOR_TYPES: tuple[MetOfficeSensorEntityDescription, ...] = ( + MetOfficeSensorEntityDescription( key="name", + native_attr_name="name", name="Station name", icon="mdi:label-outline", entity_registry_enabled_default=False, ), - SensorEntityDescription( - key="significantWeatherCode", + MetOfficeSensorEntityDescription( + key="weather", + native_attr_name="significantWeatherCode", name="Weather", icon="mdi:weather-sunny", # but will adapt to current conditions entity_registry_enabled_default=True, ), - SensorEntityDescription( - key="screenTemperature", + MetOfficeSensorEntityDescription( + key="temperature", + native_attr_name="screenTemperature", name="Temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, icon=None, entity_registry_enabled_default=True, ), - SensorEntityDescription( - key="feelsLikeTemperature", + MetOfficeSensorEntityDescription( + key="feels_like_temperature", + native_attr_name="feelsLikeTemperature", name="Feels like temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, icon=None, entity_registry_enabled_default=False, ), - SensorEntityDescription( - key="mslp", + MetOfficeSensorEntityDescription( + key="pressure", + native_attr_name="mslp", name="Pressure", device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE, native_unit_of_measurement=UnitOfPressure.PA, icon=None, entity_registry_enabled_default=True, ), - SensorEntityDescription( - key="windSpeed10m", + MetOfficeSensorEntityDescription( + key="wind_speed", + native_attr_name="windSpeed10m", name="Wind speed", native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, # Hint mph because that's the preferred unit for wind speeds in UK @@ -93,14 +107,16 @@ device_class=SensorDeviceClass.WIND_SPEED, entity_registry_enabled_default=True, ), - SensorEntityDescription( - key="windDirectionFrom10m", + MetOfficeSensorEntityDescription( + key="wind_direction", + native_attr_name="windDirectionFrom10m", name="Wind direction", icon="mdi:compass-outline", entity_registry_enabled_default=False, ), - SensorEntityDescription( - key="windGustSpeed10m", + MetOfficeSensorEntityDescription( + key="wind_gust", + native_attr_name="windGustSpeed10m", name="Wind gust", native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, # Hint mph because that's the preferred unit for wind speeds in UK @@ -109,29 +125,33 @@ device_class=SensorDeviceClass.WIND_SPEED, entity_registry_enabled_default=False, ), - SensorEntityDescription( + MetOfficeSensorEntityDescription( key="visibility", + native_attr_name="visibility", name="Visibility distance", native_unit_of_measurement=UnitOfLength.METERS, icon="mdi:eye", entity_registry_enabled_default=False, ), - SensorEntityDescription( - key="uvIndex", + MetOfficeSensorEntityDescription( + key="uv", + native_attr_name="uvIndex", name="UV index", native_unit_of_measurement=UV_INDEX, icon="mdi:weather-sunny-alert", entity_registry_enabled_default=True, ), - SensorEntityDescription( - key="probOfPrecipitation", + MetOfficeSensorEntityDescription( + key="precipitation", + native_attr_name="probOfPrecipitation", name="Probability of precipitation", native_unit_of_measurement=PERCENTAGE, icon="mdi:weather-rainy", entity_registry_enabled_default=True, ), - SensorEntityDescription( - key="screenRelativeHumidity", + MetOfficeSensorEntityDescription( + key="humidity", + native_attr_name="screenRelativeHumidity", name="Humidity", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, @@ -192,11 +212,13 @@ class MetOfficeCurrentSensor( _attr_attribution = ATTRIBUTION _attr_has_entity_name = True + entity_description: MetOfficeSensorEntityDescription + def __init__( self, coordinator: DataUpdateCoordinator[Forecast], hass_data: dict[str, Any], - description: SensorEntityDescription, + description: MetOfficeSensorEntityDescription, ) -> None: """Initialize the sensor.""" super().__init__(coordinator) @@ -206,7 +228,6 @@ def __init__( self._attr_device_info = get_device_info( coordinates=hass_data[METOFFICE_COORDINATES], name=hass_data[METOFFICE_NAME] ) - self._attr_name = f"{description.name}" self._attr_unique_id = f"{description.key}_{hass_data[METOFFICE_COORDINATES]}" self._attr_entity_registry_enabled_default = ( self.entity_description.entity_registry_enabled_default @@ -215,9 +236,14 @@ def __init__( @property def native_value(self) -> StateType: """Return the state of the sensor.""" - value = get_attribute(self.coordinator.data.now(), self.entity_description.key) + value = get_attribute( + self.coordinator.data.now(), self.entity_description.native_attr_name + ) - if self.entity_description.key == "significantWeatherCode" and value: + if ( + self.entity_description.native_attr_name == "significantWeatherCode" + and value + ): value = CONDITION_MAP.get(value) return value @@ -226,7 +252,7 @@ def native_value(self) -> StateType: def icon(self) -> str | None: """Return the icon for the entity card.""" value = self.entity_description.icon - if self.entity_description.key == "significantWeatherCode": + if self.entity_description.native_attr_name == "significantWeatherCode": value = self.state if value is None: value = "sunny" diff --git a/homeassistant/components/metoffice/strings.json b/homeassistant/components/metoffice/strings.json index b80aa686b3a41..5c3ffa13632d2 100644 --- a/homeassistant/components/metoffice/strings.json +++ b/homeassistant/components/metoffice/strings.json @@ -11,6 +11,7 @@ }, "reauth_confirm": { "title": "Reauthenticate with DataHub API", + "description": "Please re-enter you DataHub API key. If you are still using an old Datapoint API key, you need to sign up for DataHub API now, see documentation for details.", "data": { "api_key": "[%key:common::config_flow::data::api_key%]" } diff --git a/tests/components/metoffice/const.py b/tests/components/metoffice/const.py index 189e5e68242ad..80e76bc3c2440 100644 --- a/tests/components/metoffice/const.py +++ b/tests/components/metoffice/const.py @@ -34,21 +34,21 @@ } KINGSLYNN_SENSOR_RESULTS = { - "significantWeatherCode": ("significantWeatherCode", "rainy"), - "screenTemperature": ("screenTemperature", "7.87"), - "uvIndex": ("uvIndex", "1"), - "probOfPrecipitation": ("probOfPrecipitation", "67"), - "mslp": ("mslp", "998.20"), - "windSpeed10m": ("windSpeed10m", "22.21"), + "weather": ("weather", "rainy"), + "temperature": ("temperature", "7.87"), + "uv": ("uv", "1"), + "precipitation": ("precipitation", "67"), + "pressure": ("pressure", "998.20"), + "wind_speed": ("wind_speed", "22.21"), } WAVERTREE_SENSOR_RESULTS = { - "significantWeatherCode": ("significantWeatherCode", "rainy"), - "screenTemperature": ("screenTemperature", "9.28"), - "uvIndex": ("uvIndex", "1"), - "probOfPrecipitation": ("probOfPrecipitation", "61"), - "mslp": ("mslp", "987.50"), - "windSpeed10m": ("windSpeed10m", "17.60"), + "weather": ("weather", "rainy"), + "temperature": ("temperature", "9.28"), + "uv": ("uv", "1"), + "precipitation": ("precipitation", "61"), + "pressure": ("pressure", "987.50"), + "wind_speed": ("wind_speed", "17.60"), } DEVICE_KEY_KINGSLYNN = {(DOMAIN, TEST_COORDINATES_KINGSLYNN)} diff --git a/tests/components/metoffice/test_init.py b/tests/components/metoffice/test_init.py index 30fb9cba0ba8e..8cf7c8116e85e 100644 --- a/tests/components/metoffice/test_init.py +++ b/tests/components/metoffice/test_init.py @@ -1,112 +1 @@ """Tests for metoffice init.""" - -from __future__ import annotations - -import datetime - -import pytest - -from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN -from homeassistant.core import HomeAssistant -from homeassistant.helpers import entity_registry as er - -from .const import DOMAIN, METOFFICE_CONFIG_WAVERTREE, TEST_COORDINATES_WAVERTREE - -from tests.common import MockConfigEntry - - -@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) -@pytest.mark.parametrize( - ("old_unique_id", "new_unique_id", "migration_needed"), - [ - ( - f"weather_{TEST_COORDINATES_WAVERTREE}", - f"significantWeatherCode_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"temperature_{TEST_COORDINATES_WAVERTREE}", - f"screenTemperature_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"feels_like_temperature_{TEST_COORDINATES_WAVERTREE}", - f"feelsLikeTemperature_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"wind_speed_{TEST_COORDINATES_WAVERTREE}", - f"windSpeed10m_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"wind_direction_{TEST_COORDINATES_WAVERTREE}", - f"windDirectionFrom10m_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"wind_gust_{TEST_COORDINATES_WAVERTREE}", - f"windGustSpeed10m_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"uv_{TEST_COORDINATES_WAVERTREE}", - f"uvIndex_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"precipitation_{TEST_COORDINATES_WAVERTREE}", - f"probOfPrecipitation_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"humidity_{TEST_COORDINATES_WAVERTREE}", - f"screenRelativeHumidity_{TEST_COORDINATES_WAVERTREE}", - True, - ), - ( - f"name_{TEST_COORDINATES_WAVERTREE}", - f"name_{TEST_COORDINATES_WAVERTREE}", - False, - ), - ("abcde", "abcde", False), - ], -) -async def test_migrate_unique_id( - hass: HomeAssistant, - entity_registry: er.EntityRegistry, - old_unique_id: str, - new_unique_id: str, - migration_needed: bool, -) -> None: - """Test unique id migration.""" - - entry = MockConfigEntry( - domain=DOMAIN, - data=METOFFICE_CONFIG_WAVERTREE, - ) - entry.add_to_hass(hass) - - entity: er.RegistryEntry = entity_registry.async_get_or_create( - suggested_object_id="my_sensor", - disabled_by=None, - domain=SENSOR_DOMAIN, - platform=DOMAIN, - unique_id=old_unique_id, - config_entry=entry, - ) - assert entity.unique_id == old_unique_id - - await hass.config_entries.async_setup(entry.entry_id) - await hass.async_block_till_done() - - if migration_needed: - assert ( - entity_registry.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, old_unique_id) - is None - ) - - assert ( - entity_registry.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, new_unique_id) - == "sensor.my_sensor" - ) From 4d852c1743b48fa7a45ebec4c6b8597b3735a5ec Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:40:20 +0000 Subject: [PATCH 07/12] one more nit --- homeassistant/components/metoffice/sensor.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index e6f726265fe5b..080b42734c690 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -229,9 +229,6 @@ def __init__( coordinates=hass_data[METOFFICE_COORDINATES], name=hass_data[METOFFICE_NAME] ) self._attr_unique_id = f"{description.key}_{hass_data[METOFFICE_COORDINATES]}" - self._attr_entity_registry_enabled_default = ( - self.entity_description.entity_registry_enabled_default - ) @property def native_value(self) -> StateType: From 3d6f7e2fd367003639637cfbbf8135745a891d60 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:24:49 +0000 Subject: [PATCH 08/12] validate credewntials in reauth flow --- .../components/metoffice/config_flow.py | 82 +++++++++++++------ .../components/metoffice/strings.json | 1 + .../components/metoffice/test_config_flow.py | 15 +++- 3 files changed, 68 insertions(+), 30 deletions(-) diff --git a/homeassistant/components/metoffice/config_flow.py b/homeassistant/components/metoffice/config_flow.py index 5c7f2517236d7..7078d2a451e03 100644 --- a/homeassistant/components/metoffice/config_flow.py +++ b/homeassistant/components/metoffice/config_flow.py @@ -9,6 +9,7 @@ import datapoint from datapoint.exceptions import APIException import datapoint.Manager +from requests import HTTPError import voluptuous as vol from homeassistant.config_entries import ConfigFlow, ConfigFlowResult @@ -22,29 +23,40 @@ _LOGGER = logging.getLogger(__name__) -async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, str]: +async def validate_input( + hass: HomeAssistant, latitude: float, longitude: float, api_key: str +) -> dict[str, Any]: """Validate that the user input allows us to connect to DataPoint. Data has the keys from DATA_SCHEMA with values provided by the user. """ - latitude = data[CONF_LATITUDE] - longitude = data[CONF_LONGITUDE] - api_key = data[CONF_API_KEY] - + errors = {} connection = datapoint.Manager.Manager(api_key=api_key) - forecast = await hass.async_add_executor_job( - connection.get_forecast, - latitude, - longitude, - "daily", - False, - ) + try: + forecast = await hass.async_add_executor_job( + connection.get_forecast, + latitude, + longitude, + "daily", + False, + ) + + if forecast is None: + errors["base"] = "cannot_connect" - if forecast is None: - raise CannotConnect + except (HTTPError, APIException) as err: + if isinstance(err, HTTPError) and err.response.status_code == 401: + errors["base"] = "invalid_auth" + else: + errors["base"] = "cannot_connect" + except Exception: + _LOGGER.exception("Unexpected exception") + errors["base"] = "unknown" + else: + return {"site_name": forecast.name, "errors": errors} - return {"site_name": forecast.name} + return {"errors": errors} class MetOfficeConfigFlow(ConfigFlow, domain=DOMAIN): @@ -63,15 +75,17 @@ async def async_step_user( ) self._abort_if_unique_id_configured() - try: - info = await validate_input(self.hass, user_input) - except (CannotConnect, APIException): - errors["base"] = "cannot_connect" - except Exception: - _LOGGER.exception("Unexpected exception") - errors["base"] = "unknown" - else: - user_input[CONF_NAME] = info["site_name"] + result = await validate_input( + self.hass, + latitude=user_input[CONF_LATITUDE], + longitude=user_input[CONF_LONGITUDE], + api_key=user_input[CONF_API_KEY], + ) + + errors = result["errors"] + + if not errors: + user_input[CONF_NAME] = result["site_name"] return self.async_create_entry( title=user_input[CONF_NAME], data=user_input ) @@ -102,12 +116,25 @@ async def async_step_reauth_confirm( self, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: """Dialog that informs the user that reauth is required.""" + errors = {} + + entry = self._get_reauth_entry() if user_input is not None: - return self.async_update_reload_and_abort( - self._get_reauth_entry(), - data_updates=user_input, + result = await validate_input( + self.hass, + latitude=entry.data[CONF_LATITUDE], + longitude=entry.data[CONF_LONGITUDE], + api_key=user_input[CONF_API_KEY], ) + errors = result["errors"] + + if not errors: + return self.async_update_reload_and_abort( + self._get_reauth_entry(), + data_updates=user_input, + ) + return self.async_show_form( step_id="reauth_confirm", data_schema=vol.Schema( @@ -115,6 +142,7 @@ async def async_step_reauth_confirm( vol.Required(CONF_API_KEY): str, } ), + errors=errors, ) diff --git a/homeassistant/components/metoffice/strings.json b/homeassistant/components/metoffice/strings.json index 5c3ffa13632d2..479e7ce569483 100644 --- a/homeassistant/components/metoffice/strings.json +++ b/homeassistant/components/metoffice/strings.json @@ -19,6 +19,7 @@ }, "error": { "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", + "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", "unknown": "[%key:common::config_flow::error::unknown%]" }, "abort": { diff --git a/tests/components/metoffice/test_config_flow.py b/tests/components/metoffice/test_config_flow.py index 83336ed03d91a..3c36e02a97321 100644 --- a/tests/components/metoffice/test_config_flow.py +++ b/tests/components/metoffice/test_config_flow.py @@ -188,6 +188,15 @@ async def test_reauth_flow( assert len(flows) == 1 assert flows[0]["step_id"] == "reauth_confirm" + result = await hass.config_entries.flow.async_configure( + flows[0]["flow_id"], + {CONF_API_KEY: TEST_API_KEY}, + ) + await hass.async_block_till_done() + + assert result["type"] is FlowResultType.FORM + assert result["errors"] == {"base": "invalid_auth"} + requests_mock.get( "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", text=wavertree_daily, @@ -197,11 +206,11 @@ async def test_reauth_flow( text=wavertree_hourly, ) - result3 = await hass.config_entries.flow.async_configure( + result = await hass.config_entries.flow.async_configure( flows[0]["flow_id"], {CONF_API_KEY: TEST_API_KEY}, ) await hass.async_block_till_done() - assert result3["type"] is FlowResultType.ABORT - assert result3["reason"] == "reauth_successful" + assert result["type"] is FlowResultType.ABORT + assert result["reason"] == "reauth_successful" From e77410e00b61b791dc7e41d75dda90a533acd9f2 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:36:54 +0000 Subject: [PATCH 09/12] Addressed review comments --- .../components/metoffice/__init__.py | 17 - homeassistant/components/metoffice/const.py | 26 -- homeassistant/components/metoffice/weather.py | 38 +- .../metoffice/snapshots/test_weather.ambr | 380 +----------------- .../components/metoffice/test_config_flow.py | 9 +- tests/components/metoffice/test_init.py | 64 +++ tests/components/metoffice/test_weather.py | 6 +- 7 files changed, 73 insertions(+), 467 deletions(-) diff --git a/homeassistant/components/metoffice/__init__.py b/homeassistant/components/metoffice/__init__.py index a8f92b2b31d94..2590354906137 100644 --- a/homeassistant/components/metoffice/__init__.py +++ b/homeassistant/components/metoffice/__init__.py @@ -29,7 +29,6 @@ METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, - METOFFICE_TWICE_DAILY_COORDINATOR, ) from .helpers import fetch_data @@ -55,11 +54,6 @@ async def async_update_daily() -> datapoint.Forecast: fetch_data, connection, latitude, longitude, "daily" ) - async def async_update_twice_daily() -> datapoint.Forecast: - return await hass.async_add_executor_job( - fetch_data, connection, latitude, longitude, "twice-daily" - ) - async def async_update_hourly() -> datapoint.Forecast: return await hass.async_add_executor_job( fetch_data, connection, latitude, longitude, "hourly" @@ -74,15 +68,6 @@ async def async_update_hourly() -> datapoint.Forecast: update_interval=DEFAULT_SCAN_INTERVAL, ) - metoffice_twice_daily_coordinator = TimestampDataUpdateCoordinator( - hass, - _LOGGER, - config_entry=entry, - name=f"MetOffice Twice Daily Coordinator for {site_name}", - update_method=async_update_twice_daily, - update_interval=DEFAULT_SCAN_INTERVAL, - ) - metoffice_hourly_coordinator = TimestampDataUpdateCoordinator( hass, _LOGGER, @@ -95,7 +80,6 @@ async def async_update_hourly() -> datapoint.Forecast: metoffice_hass_data = hass.data.setdefault(DOMAIN, {}) metoffice_hass_data[entry.entry_id] = { METOFFICE_DAILY_COORDINATOR: metoffice_daily_coordinator, - METOFFICE_TWICE_DAILY_COORDINATOR: metoffice_twice_daily_coordinator, METOFFICE_HOURLY_COORDINATOR: metoffice_hourly_coordinator, METOFFICE_NAME: site_name, METOFFICE_COORDINATES: coordinates, @@ -104,7 +88,6 @@ async def async_update_hourly() -> datapoint.Forecast: # Fetch initial data so we have data when entities subscribe await asyncio.gather( metoffice_daily_coordinator.async_config_entry_first_refresh(), - metoffice_twice_daily_coordinator.async_config_entry_first_refresh(), metoffice_hourly_coordinator.async_config_entry_first_refresh(), ) diff --git a/homeassistant/components/metoffice/const.py b/homeassistant/components/metoffice/const.py index c0133b2c3bd3c..68c94f3d7a571 100644 --- a/homeassistant/components/metoffice/const.py +++ b/homeassistant/components/metoffice/const.py @@ -40,7 +40,6 @@ METOFFICE_COORDINATES = "metoffice_coordinates" METOFFICE_HOURLY_COORDINATOR = "metoffice_hourly_coordinator" -METOFFICE_TWICE_DAILY_COORDINATOR = "metoffice_twice_daily_coordinator" METOFFICE_DAILY_COORDINATOR = "metoffice_daily_coordinator" METOFFICE_MONITORED_CONDITIONS = "metoffice_monitored_conditions" METOFFICE_NAME = "metoffice_name" @@ -81,31 +80,6 @@ ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "windGustSpeed10m", } -DAY_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { - ATTR_FORECAST_CONDITION: "daySignificantWeatherCode", - ATTR_FORECAST_NATIVE_APPARENT_TEMP: "dayMaxFeelsLikeTemp", - ATTR_FORECAST_NATIVE_PRESSURE: "middayMslp", - ATTR_FORECAST_NATIVE_TEMP: "dayUpperBoundMaxTemp", - ATTR_FORECAST_NATIVE_TEMP_LOW: "dayLowerBoundMaxTemp", - ATTR_FORECAST_PRECIPITATION_PROBABILITY: "dayProbabilityOfPrecipitation", - ATTR_FORECAST_UV_INDEX: "maxUvIndex", - ATTR_FORECAST_WIND_BEARING: "midday10MWindDirection", - ATTR_FORECAST_NATIVE_WIND_SPEED: "midday10MWindSpeed", - ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "midday10MWindGust", -} - -NIGHT_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { - ATTR_FORECAST_CONDITION: "nightSignificantWeatherCode", - ATTR_FORECAST_NATIVE_APPARENT_TEMP: "nightMinFeelsLikeTemp", - ATTR_FORECAST_NATIVE_PRESSURE: "midnightMslp", - ATTR_FORECAST_NATIVE_TEMP: "nightUpperBoundMinTemp", - ATTR_FORECAST_NATIVE_TEMP_LOW: "nightLowerBoundMinTemp", - ATTR_FORECAST_PRECIPITATION_PROBABILITY: "nightProbabilityOfPrecipitation", - ATTR_FORECAST_WIND_BEARING: "midnight10MWindDirection", - ATTR_FORECAST_NATIVE_WIND_SPEED: "midnight10MWindSpeed", - ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: "midnight10MWindGust", -} - DAILY_FORECAST_ATTRIBUTE_MAP: dict[str, str] = { ATTR_FORECAST_CONDITION: "daySignificantWeatherCode", ATTR_FORECAST_NATIVE_APPARENT_TEMP: "dayMaxFeelsLikeTemp", diff --git a/homeassistant/components/metoffice/weather.py b/homeassistant/components/metoffice/weather.py index 08d9f7de815f4..bd03413c04a6b 100644 --- a/homeassistant/components/metoffice/weather.py +++ b/homeassistant/components/metoffice/weather.py @@ -9,7 +9,6 @@ from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, - ATTR_FORECAST_IS_DAYTIME, ATTR_FORECAST_NATIVE_APPARENT_TEMP, ATTR_FORECAST_NATIVE_PRESSURE, ATTR_FORECAST_NATIVE_TEMP, @@ -42,15 +41,12 @@ ATTRIBUTION, CONDITION_MAP, DAILY_FORECAST_ATTRIBUTE_MAP, - DAY_FORECAST_ATTRIBUTE_MAP, DOMAIN, HOURLY_FORECAST_ATTRIBUTE_MAP, METOFFICE_COORDINATES, METOFFICE_DAILY_COORDINATOR, METOFFICE_HOURLY_COORDINATOR, METOFFICE_NAME, - METOFFICE_TWICE_DAILY_COORDINATOR, - NIGHT_FORECAST_ATTRIBUTE_MAP, ) from .helpers import get_attribute @@ -74,7 +70,6 @@ async def async_setup_entry( [ MetOfficeWeather( hass_data[METOFFICE_DAILY_COORDINATOR], - hass_data[METOFFICE_TWICE_DAILY_COORDINATOR], hass_data[METOFFICE_HOURLY_COORDINATOR], hass_data, ) @@ -89,19 +84,6 @@ def _build_hourly_forecast_data(timestep: dict[str, Any]) -> Forecast: return data -def _build_twice_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: - data = Forecast(datetime=timestep["time"].isoformat()) - - # day and night forecasts have slightly different format - if "daySignificantWeatherCode" in timestep: - data[ATTR_FORECAST_IS_DAYTIME] = True - _populate_forecast_data(data, timestep, DAY_FORECAST_ATTRIBUTE_MAP) - else: - data[ATTR_FORECAST_IS_DAYTIME] = False - _populate_forecast_data(data, timestep, NIGHT_FORECAST_ATTRIBUTE_MAP) - return data - - def _build_daily_forecast_data(timestep: dict[str, Any]) -> Forecast: data = Forecast(datetime=timestep["time"].isoformat()) _populate_forecast_data(data, timestep, DAILY_FORECAST_ATTRIBUTE_MAP) @@ -168,15 +150,12 @@ class MetOfficeWeather( _attr_native_visibility_unit = UnitOfLength.METERS _attr_native_wind_speed_unit = UnitOfSpeed.METERS_PER_SECOND _attr_supported_features = ( - WeatherEntityFeature.FORECAST_HOURLY - | WeatherEntityFeature.FORECAST_TWICE_DAILY - | WeatherEntityFeature.FORECAST_DAILY + WeatherEntityFeature.FORECAST_HOURLY | WeatherEntityFeature.FORECAST_DAILY ) def __init__( self, coordinator_daily: TimestampDataUpdateCoordinator[ForecastData], - coordinator_twice_daily: TimestampDataUpdateCoordinator[ForecastData], coordinator_hourly: TimestampDataUpdateCoordinator[ForecastData], hass_data: dict[str, Any], ) -> None: @@ -185,7 +164,6 @@ def __init__( super().__init__( observation_coordinator, daily_coordinator=coordinator_daily, - twice_daily_coordinator=coordinator_twice_daily, hourly_coordinator=coordinator_hourly, ) @@ -274,20 +252,6 @@ def _async_forecast_daily(self) -> list[Forecast] | None: if timestep["time"] > datetime.now(tz=timesteps[0]["time"].tzinfo) ] - @callback - def _async_forecast_twice_daily(self) -> list[Forecast] | None: - """Return the twice daily forecast in native units.""" - coordinator = cast( - TimestampDataUpdateCoordinator[ForecastData], - self.forecast_coordinators["twice_daily"], - ) - timesteps = coordinator.data.timesteps - return [ - _build_twice_daily_forecast_data(timestep) - for timestep in timesteps - if timestep["time"] > datetime.now(tz=timesteps[0]["time"].tzinfo) - ] - @callback def _async_forecast_hourly(self) -> list[Forecast] | None: """Return the hourly forecast in native units.""" diff --git a/tests/components/metoffice/snapshots/test_weather.ambr b/tests/components/metoffice/snapshots/test_weather.ambr index 414b0eed76d7c..a567f9bde740a 100644 --- a/tests/components/metoffice/snapshots/test_weather.ambr +++ b/tests/components/metoffice/snapshots/test_weather.ambr @@ -92,194 +92,6 @@ }) # --- # name: test_forecast_service[get_forecasts].1 - dict({ - 'weather.met_office_wavertree': dict({ - 'forecast': list([ - dict({ - 'apparent_temperature': 4.8, - 'condition': 'cloudy', - 'datetime': '2024-11-24T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 23, - 'pressure': 987.12, - 'temperature': 10.7, - 'templow': 7.0, - 'uv_index': None, - 'wind_bearing': 211, - 'wind_gust_speed': 47.2, - 'wind_speed': 26.39, - }), - dict({ - 'apparent_temperature': 9.2, - 'condition': 'cloudy', - 'datetime': '2024-11-24T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 26, - 'pressure': 987.48, - 'temperature': 15.2, - 'templow': 11.9, - 'uv_index': 1, - 'wind_bearing': 203, - 'wind_gust_speed': 42.66, - 'wind_speed': 23.94, - }), - dict({ - 'apparent_temperature': 4.2, - 'condition': 'partlycloudy', - 'datetime': '2024-11-25T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 6, - 'pressure': 1004.81, - 'temperature': 9.3, - 'templow': 4.4, - 'uv_index': None, - 'wind_bearing': 262, - 'wind_gust_speed': 47.99, - 'wind_speed': 29.23, - }), - dict({ - 'apparent_temperature': 5.3, - 'condition': 'partlycloudy', - 'datetime': '2024-11-25T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 5, - 'pressure': 994.88, - 'temperature': 11.0, - 'templow': 8.4, - 'uv_index': 1, - 'wind_bearing': 251, - 'wind_gust_speed': 52.16, - 'wind_speed': 30.67, - }), - dict({ - 'apparent_temperature': 1.3, - 'condition': 'cloudy', - 'datetime': '2024-11-26T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 44, - 'pressure': 1013.9, - 'temperature': 7.5, - 'templow': -0.4, - 'uv_index': None, - 'wind_bearing': 74, - 'wind_gust_speed': 19.51, - 'wind_speed': 11.41, - }), - dict({ - 'apparent_temperature': 5.9, - 'condition': 'partlycloudy', - 'datetime': '2024-11-26T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 6, - 'pressure': 1012.93, - 'temperature': 10.1, - 'templow': 6.5, - 'uv_index': 1, - 'wind_bearing': 265, - 'wind_gust_speed': 34.49, - 'wind_speed': 20.45, - }), - dict({ - 'apparent_temperature': 0.2, - 'condition': 'clear-night', - 'datetime': '2024-11-27T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 9, - 'pressure': 1021.75, - 'temperature': 7.2, - 'templow': -3.0, - 'uv_index': None, - 'wind_bearing': 31, - 'wind_gust_speed': 19.94, - 'wind_speed': 11.84, - }), - dict({ - 'apparent_temperature': 3.3, - 'condition': 'rainy', - 'datetime': '2024-11-27T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 43, - 'pressure': 1014.39, - 'temperature': 11.1, - 'templow': 3.0, - 'uv_index': 1, - 'wind_bearing': 8, - 'wind_gust_speed': 32.18, - 'wind_speed': 18.54, - }), - dict({ - 'apparent_temperature': 1.6, - 'condition': 'cloudy', - 'datetime': '2024-11-28T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 9, - 'pressure': 1023.82, - 'temperature': 8.2, - 'templow': -1.9, - 'uv_index': None, - 'wind_bearing': 131, - 'wind_gust_speed': 33.16, - 'wind_speed': 20.05, - }), - dict({ - 'apparent_temperature': 3.0, - 'condition': 'cloudy', - 'datetime': '2024-11-28T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 9, - 'pressure': 1025.12, - 'temperature': 9.4, - 'templow': 1.3, - 'uv_index': 1, - 'wind_bearing': 104, - 'wind_gust_speed': 22.36, - 'wind_speed': 12.64, - }), - dict({ - 'apparent_temperature': 5.0, - 'condition': 'cloudy', - 'datetime': '2024-11-29T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 13, - 'pressure': 1016.88, - 'temperature': 10.8, - 'templow': -1.9, - 'uv_index': None, - 'wind_bearing': 151, - 'wind_gust_speed': 33.16, - 'wind_speed': 20.12, - }), - dict({ - 'apparent_temperature': 4.9, - 'condition': 'cloudy', - 'datetime': '2024-11-29T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 11, - 'pressure': 1019.85, - 'temperature': 12.6, - 'templow': 4.2, - 'uv_index': 1, - 'wind_bearing': 137, - 'wind_gust_speed': 38.59, - 'wind_speed': 23.0, - }), - ]), - }), - }) -# --- -# name: test_forecast_service[get_forecasts].2 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ @@ -911,7 +723,7 @@ }), }) # --- -# name: test_forecast_service[get_forecasts].3 +# name: test_forecast_service[get_forecasts].2 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ @@ -1003,195 +815,7 @@ }), }) # --- -# name: test_forecast_service[get_forecasts].4 - dict({ - 'weather.met_office_wavertree': dict({ - 'forecast': list([ - dict({ - 'apparent_temperature': 4.8, - 'condition': 'cloudy', - 'datetime': '2024-11-24T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 23, - 'pressure': 987.12, - 'temperature': 10.7, - 'templow': 7.0, - 'uv_index': None, - 'wind_bearing': 211, - 'wind_gust_speed': 47.2, - 'wind_speed': 26.39, - }), - dict({ - 'apparent_temperature': 9.2, - 'condition': 'cloudy', - 'datetime': '2024-11-24T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 26, - 'pressure': 987.48, - 'temperature': 15.2, - 'templow': 11.9, - 'uv_index': 1, - 'wind_bearing': 203, - 'wind_gust_speed': 42.66, - 'wind_speed': 23.94, - }), - dict({ - 'apparent_temperature': 4.2, - 'condition': 'partlycloudy', - 'datetime': '2024-11-25T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 6, - 'pressure': 1004.81, - 'temperature': 9.3, - 'templow': 4.4, - 'uv_index': None, - 'wind_bearing': 262, - 'wind_gust_speed': 47.99, - 'wind_speed': 29.23, - }), - dict({ - 'apparent_temperature': 5.3, - 'condition': 'partlycloudy', - 'datetime': '2024-11-25T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 5, - 'pressure': 994.88, - 'temperature': 11.0, - 'templow': 8.4, - 'uv_index': 1, - 'wind_bearing': 251, - 'wind_gust_speed': 52.16, - 'wind_speed': 30.67, - }), - dict({ - 'apparent_temperature': 1.3, - 'condition': 'cloudy', - 'datetime': '2024-11-26T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 44, - 'pressure': 1013.9, - 'temperature': 7.5, - 'templow': -0.4, - 'uv_index': None, - 'wind_bearing': 74, - 'wind_gust_speed': 19.51, - 'wind_speed': 11.41, - }), - dict({ - 'apparent_temperature': 5.9, - 'condition': 'partlycloudy', - 'datetime': '2024-11-26T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 6, - 'pressure': 1012.93, - 'temperature': 10.1, - 'templow': 6.5, - 'uv_index': 1, - 'wind_bearing': 265, - 'wind_gust_speed': 34.49, - 'wind_speed': 20.45, - }), - dict({ - 'apparent_temperature': 0.2, - 'condition': 'clear-night', - 'datetime': '2024-11-27T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 9, - 'pressure': 1021.75, - 'temperature': 7.2, - 'templow': -3.0, - 'uv_index': None, - 'wind_bearing': 31, - 'wind_gust_speed': 19.94, - 'wind_speed': 11.84, - }), - dict({ - 'apparent_temperature': 3.3, - 'condition': 'rainy', - 'datetime': '2024-11-27T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 43, - 'pressure': 1014.39, - 'temperature': 11.1, - 'templow': 3.0, - 'uv_index': 1, - 'wind_bearing': 8, - 'wind_gust_speed': 32.18, - 'wind_speed': 18.54, - }), - dict({ - 'apparent_temperature': 1.6, - 'condition': 'cloudy', - 'datetime': '2024-11-28T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 9, - 'pressure': 1023.82, - 'temperature': 8.2, - 'templow': -1.9, - 'uv_index': None, - 'wind_bearing': 131, - 'wind_gust_speed': 33.16, - 'wind_speed': 20.05, - }), - dict({ - 'apparent_temperature': 3.0, - 'condition': 'cloudy', - 'datetime': '2024-11-28T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 9, - 'pressure': 1025.12, - 'temperature': 9.4, - 'templow': 1.3, - 'uv_index': 1, - 'wind_bearing': 104, - 'wind_gust_speed': 22.36, - 'wind_speed': 12.64, - }), - dict({ - 'apparent_temperature': 5.0, - 'condition': 'cloudy', - 'datetime': '2024-11-29T00:00:00+00:00', - 'is_daytime': False, - 'precipitation': None, - 'precipitation_probability': 13, - 'pressure': 1016.88, - 'temperature': 10.8, - 'templow': -1.9, - 'uv_index': None, - 'wind_bearing': 151, - 'wind_gust_speed': 33.16, - 'wind_speed': 20.12, - }), - dict({ - 'apparent_temperature': 4.9, - 'condition': 'cloudy', - 'datetime': '2024-11-29T12:00:00+00:00', - 'is_daytime': True, - 'precipitation': None, - 'precipitation_probability': 11, - 'pressure': 1019.85, - 'temperature': 12.6, - 'templow': 4.2, - 'uv_index': 1, - 'wind_bearing': 137, - 'wind_gust_speed': 38.59, - 'wind_speed': 23.0, - }), - ]), - }), - }) -# --- -# name: test_forecast_service[get_forecasts].5 +# name: test_forecast_service[get_forecasts].3 dict({ 'weather.met_office_wavertree': dict({ 'forecast': list([ diff --git a/tests/components/metoffice/test_config_flow.py b/tests/components/metoffice/test_config_flow.py index 3c36e02a97321..87d6e508da262 100644 --- a/tests/components/metoffice/test_config_flow.py +++ b/tests/components/metoffice/test_config_flow.py @@ -1,4 +1,4 @@ -"""Test the National Weather Service (NWS) config flow.""" +"""Test the MetOffice config flow.""" import datetime import json @@ -13,7 +13,6 @@ from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import device_registry as dr -from homeassistant.util import utcnow from .const import ( METOFFICE_CONFIG_WAVERTREE, @@ -23,7 +22,7 @@ TEST_SITE_NAME_WAVERTREE, ) -from tests.common import MockConfigEntry, async_fire_time_changed, load_fixture +from tests.common import MockConfigEntry, load_fixture async def test_form(hass: HomeAssistant, requests_mock: requests_mock.Mocker) -> None: @@ -180,9 +179,7 @@ async def test_reauth_flow( status_code=401, ) - future_time = utcnow() + datetime.timedelta(minutes=40) - async_fire_time_changed(hass, future_time) - await hass.async_block_till_done(wait_background_tasks=True) + await entry.start_reauth_flow(hass) flows = hass.config_entries.flow.async_progress() assert len(flows) == 1 diff --git a/tests/components/metoffice/test_init.py b/tests/components/metoffice/test_init.py index 8cf7c8116e85e..2152742625bde 100644 --- a/tests/components/metoffice/test_init.py +++ b/tests/components/metoffice/test_init.py @@ -1 +1,65 @@ """Tests for metoffice init.""" + +import datetime +import json + +import pytest +import requests_mock + +from homeassistant.components.metoffice.const import DOMAIN +from homeassistant.core import HomeAssistant +from homeassistant.helpers import device_registry as dr +from homeassistant.util import utcnow + +from .const import METOFFICE_CONFIG_WAVERTREE + +from tests.common import MockConfigEntry, async_fire_time_changed, load_fixture + + +@pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) +async def test_reauth_on_auth_error( + hass: HomeAssistant, + requests_mock: requests_mock.Mocker, + device_registry: dr.DeviceRegistry, +) -> None: + """Test handling authentication errors and reauth flow.""" + mock_json = json.loads(load_fixture("metoffice.json", "metoffice")) + wavertree_daily = json.dumps(mock_json["wavertree_daily"]) + wavertree_hourly = json.dumps(mock_json["wavertree_hourly"]) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text=wavertree_daily, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text=wavertree_hourly, + ) + + entry = MockConfigEntry( + domain=DOMAIN, + data=METOFFICE_CONFIG_WAVERTREE, + ) + entry.add_to_hass(hass) + await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() + + assert len(device_registry.devices) == 1 + + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + text="", + status_code=401, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + text="", + status_code=401, + ) + + future_time = utcnow() + datetime.timedelta(minutes=40) + async_fire_time_changed(hass, future_time) + await hass.async_block_till_done(wait_background_tasks=True) + + flows = hass.config_entries.flow.async_progress() + assert len(flows) == 1 + assert flows[0]["step_id"] == "reauth_confirm" diff --git a/tests/components/metoffice/test_weather.py b/tests/components/metoffice/test_weather.py index 6380ba38af336..4cad0c10d8e8b 100644 --- a/tests/components/metoffice/test_weather.py +++ b/tests/components/metoffice/test_weather.py @@ -282,10 +282,10 @@ async def test_forecast_service( await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() - assert wavertree_data["wavertree_daily_mock"].call_count == 2 + assert wavertree_data["wavertree_daily_mock"].call_count == 1 assert wavertree_data["wavertree_hourly_mock"].call_count == 1 - for forecast_type in ("daily", "twice_daily", "hourly"): + for forecast_type in ("daily", "hourly"): response = await hass.services.async_call( WEATHER_DOMAIN, service, @@ -303,7 +303,7 @@ async def test_forecast_service( async_fire_time_changed(hass) await hass.async_block_till_done(wait_background_tasks=True) - for forecast_type in ("daily", "twice_daily", "hourly"): + for forecast_type in ("daily", "hourly"): response = await hass.services.async_call( WEATHER_DOMAIN, service, From 83ac7f0d79b4b34d4270884bb2cd09ccb9a6f36f Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Sun, 29 Dec 2024 21:32:14 +0000 Subject: [PATCH 10/12] Attempt to improve coverage --- .../components/metoffice/config_flow.py | 3 --- tests/components/metoffice/test_weather.py | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/metoffice/config_flow.py b/homeassistant/components/metoffice/config_flow.py index 7078d2a451e03..073941bd40610 100644 --- a/homeassistant/components/metoffice/config_flow.py +++ b/homeassistant/components/metoffice/config_flow.py @@ -42,9 +42,6 @@ async def validate_input( False, ) - if forecast is None: - errors["base"] = "cannot_connect" - except (HTTPError, APIException) as err: if isinstance(err, HTTPError) and err.response.status_code == 401: errors["base"] = "invalid_auth" diff --git a/tests/components/metoffice/test_weather.py b/tests/components/metoffice/test_weather.py index 4cad0c10d8e8b..f248ead317339 100644 --- a/tests/components/metoffice/test_weather.py +++ b/tests/components/metoffice/test_weather.py @@ -133,6 +133,22 @@ async def test_site_cannot_update( weather = hass.states.get("weather.met_office_wavertree") assert weather.state == STATE_UNAVAILABLE + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly", + status_code=404, + ) + requests_mock.get( + "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily", + status_code=404, + ) + + future_time = utcnow() + timedelta(minutes=40) + async_fire_time_changed(hass, future_time) + await hass.async_block_till_done(wait_background_tasks=True) + + weather = hass.states.get("weather.met_office_wavertree") + assert weather.state == STATE_UNAVAILABLE + @pytest.mark.freeze_time(datetime.datetime(2024, 11, 23, 12, tzinfo=datetime.UTC)) async def test_one_weather_site_running( From 3bdaf33f8914d290e7e22ce62d3170b887a57be3 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:16:54 +0000 Subject: [PATCH 11/12] Addressed comments --- .../components/metoffice/config_flow.py | 7 +++++- homeassistant/components/metoffice/sensor.py | 4 ---- .../components/metoffice/strings.json | 2 +- tests/components/metoffice/const.py | 24 +++++++++---------- tests/components/metoffice/test_sensor.py | 19 ++++++--------- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/homeassistant/components/metoffice/config_flow.py b/homeassistant/components/metoffice/config_flow.py index 073941bd40610..81369daf09a6c 100644 --- a/homeassistant/components/metoffice/config_flow.py +++ b/homeassistant/components/metoffice/config_flow.py @@ -100,7 +100,9 @@ async def async_step_user( ) return self.async_show_form( - step_id="user", data_schema=data_schema, errors=errors + step_id="user", + data_schema=data_schema, + errors=errors, ) async def async_step_reauth( @@ -139,6 +141,9 @@ async def async_step_reauth_confirm( vol.Required(CONF_API_KEY): str, } ), + description_placeholders={ + "docs_url": ("https://www.home-assistant.io/integrations/metoffice") + }, errors=errors, ) diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index 080b42734c690..bd226146afb17 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -43,8 +43,6 @@ from .helpers import get_attribute ATTR_LAST_UPDATE = "last_update" -ATTR_SENSOR_ID = "sensor_id" -ATTR_SITE_NAME = "site_name" @dataclass(frozen=True, kw_only=True) @@ -264,6 +262,4 @@ def extra_state_attributes(self) -> dict[str, Any]: """Return the state attributes of the device.""" return { ATTR_LAST_UPDATE: self.coordinator.data.now()["time"], - ATTR_SENSOR_ID: self.entity_description.key, - ATTR_SITE_NAME: self.coordinator.data.name, } diff --git a/homeassistant/components/metoffice/strings.json b/homeassistant/components/metoffice/strings.json index 479e7ce569483..b33cf9e3efcce 100644 --- a/homeassistant/components/metoffice/strings.json +++ b/homeassistant/components/metoffice/strings.json @@ -11,7 +11,7 @@ }, "reauth_confirm": { "title": "Reauthenticate with DataHub API", - "description": "Please re-enter you DataHub API key. If you are still using an old Datapoint API key, you need to sign up for DataHub API now, see documentation for details.", + "description": "Please re-enter you DataHub API key. If you are still using an old Datapoint API key, you need to sign up for DataHub API now, see [documentation]({docs_url}) for details.", "data": { "api_key": "[%key:common::config_flow::data::api_key%]" } diff --git a/tests/components/metoffice/const.py b/tests/components/metoffice/const.py index 80e76bc3c2440..2485b308981dc 100644 --- a/tests/components/metoffice/const.py +++ b/tests/components/metoffice/const.py @@ -34,21 +34,21 @@ } KINGSLYNN_SENSOR_RESULTS = { - "weather": ("weather", "rainy"), - "temperature": ("temperature", "7.87"), - "uv": ("uv", "1"), - "precipitation": ("precipitation", "67"), - "pressure": ("pressure", "998.20"), - "wind_speed": ("wind_speed", "22.21"), + "weather": "rainy", + "temperature": "7.87", + "uv_index": "1", + "probability_of_precipitation": "67", + "pressure": "998.20", + "wind_speed": "22.21", } WAVERTREE_SENSOR_RESULTS = { - "weather": ("weather", "rainy"), - "temperature": ("temperature", "9.28"), - "uv": ("uv", "1"), - "precipitation": ("precipitation", "61"), - "pressure": ("pressure", "987.50"), - "wind_speed": ("wind_speed", "17.60"), + "weather": "rainy", + "temperature": "9.28", + "uv_index": "1", + "probability_of_precipitation": "61", + "pressure": "987.50", + "wind_speed": "17.60", } DEVICE_KEY_KINGSLYNN = {(DOMAIN, TEST_COORDINATES_KINGSLYNN)} diff --git a/tests/components/metoffice/test_sensor.py b/tests/components/metoffice/test_sensor.py index e290edec5ac26..88bc52c06b992 100644 --- a/tests/components/metoffice/test_sensor.py +++ b/tests/components/metoffice/test_sensor.py @@ -2,6 +2,7 @@ import datetime import json +import re import pytest import requests_mock @@ -20,8 +21,6 @@ TEST_DATETIME_STRING, TEST_LATITUDE_WAVERTREE, TEST_LONGITUDE_WAVERTREE, - TEST_SITE_NAME_KINGSLYNN, - TEST_SITE_NAME_WAVERTREE, WAVERTREE_SENSOR_RESULTS, ) @@ -67,12 +66,11 @@ async def test_one_sensor_site_running( assert len(running_sensor_ids) > 0 for running_id in running_sensor_ids: sensor = hass.states.get(running_id) - sensor_id = sensor.attributes.get("sensor_id") - _, sensor_value = WAVERTREE_SENSOR_RESULTS[sensor_id] + sensor_id = re.search("met_office_wavertree_(.+?)$", running_id).group(1) + sensor_value = WAVERTREE_SENSOR_RESULTS[sensor_id] assert sensor.state == sensor_value assert sensor.attributes.get("last_update").isoformat() == TEST_DATETIME_STRING - assert sensor.attributes.get("site_name") == TEST_SITE_NAME_WAVERTREE assert sensor.attributes.get("attribution") == ATTRIBUTION @@ -138,25 +136,22 @@ async def test_two_sensor_sites_running( assert len(running_sensor_ids) > 0 for running_id in running_sensor_ids: sensor = hass.states.get(running_id) - sensor_id = sensor.attributes.get("sensor_id") if "wavertree" in running_id: - _, sensor_value = WAVERTREE_SENSOR_RESULTS[sensor_id] + sensor_id = re.search("met_office_wavertree_(.+?)$", running_id).group(1) + sensor_value = WAVERTREE_SENSOR_RESULTS[sensor_id] assert sensor.state == sensor_value assert ( sensor.attributes.get("last_update").isoformat() == TEST_DATETIME_STRING ) - assert sensor.attributes.get("sensor_id") == sensor_id - assert sensor.attributes.get("site_name") == TEST_SITE_NAME_WAVERTREE assert sensor.attributes.get("attribution") == ATTRIBUTION else: - _, sensor_value = KINGSLYNN_SENSOR_RESULTS[sensor_id] + sensor_id = re.search("met_office_king_s_lynn_(.+?)$", running_id).group(1) + sensor_value = KINGSLYNN_SENSOR_RESULTS[sensor_id] assert sensor.state == sensor_value assert ( sensor.attributes.get("last_update").isoformat() == TEST_DATETIME_STRING ) - assert sensor.attributes.get("sensor_id") == sensor_id - assert sensor.attributes.get("site_name") == TEST_SITE_NAME_KINGSLYNN assert sensor.attributes.get("attribution") == ATTRIBUTION From ab476fcc19f04da8f5d9b0cb6cee4ad353021c43 Mon Sep 17 00:00:00 2001 From: avee87 <6134677+avee87@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:49:56 +0000 Subject: [PATCH 12/12] Reverted unnecessary reordering --- .../components/metoffice/__init__.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/metoffice/__init__.py b/homeassistant/components/metoffice/__init__.py index 2590354906137..6977974c2e551 100644 --- a/homeassistant/components/metoffice/__init__.py +++ b/homeassistant/components/metoffice/__init__.py @@ -49,46 +49,46 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: connection = datapoint.Manager.Manager(api_key=api_key) - async def async_update_daily() -> datapoint.Forecast: + async def async_update_hourly() -> datapoint.Forecast: return await hass.async_add_executor_job( - fetch_data, connection, latitude, longitude, "daily" + fetch_data, connection, latitude, longitude, "hourly" ) - async def async_update_hourly() -> datapoint.Forecast: + async def async_update_daily() -> datapoint.Forecast: return await hass.async_add_executor_job( - fetch_data, connection, latitude, longitude, "hourly" + fetch_data, connection, latitude, longitude, "daily" ) - metoffice_daily_coordinator = TimestampDataUpdateCoordinator( + metoffice_hourly_coordinator = TimestampDataUpdateCoordinator( hass, _LOGGER, config_entry=entry, - name=f"MetOffice Daily Coordinator for {site_name}", - update_method=async_update_daily, + name=f"MetOffice Hourly Coordinator for {site_name}", + update_method=async_update_hourly, update_interval=DEFAULT_SCAN_INTERVAL, ) - metoffice_hourly_coordinator = TimestampDataUpdateCoordinator( + metoffice_daily_coordinator = TimestampDataUpdateCoordinator( hass, _LOGGER, config_entry=entry, - name=f"MetOffice Hourly Coordinator for {site_name}", - update_method=async_update_hourly, + name=f"MetOffice Daily Coordinator for {site_name}", + update_method=async_update_daily, update_interval=DEFAULT_SCAN_INTERVAL, ) metoffice_hass_data = hass.data.setdefault(DOMAIN, {}) metoffice_hass_data[entry.entry_id] = { - METOFFICE_DAILY_COORDINATOR: metoffice_daily_coordinator, METOFFICE_HOURLY_COORDINATOR: metoffice_hourly_coordinator, + METOFFICE_DAILY_COORDINATOR: metoffice_daily_coordinator, METOFFICE_NAME: site_name, METOFFICE_COORDINATES: coordinates, } # Fetch initial data so we have data when entities subscribe await asyncio.gather( - metoffice_daily_coordinator.async_config_entry_first_refresh(), metoffice_hourly_coordinator.async_config_entry_first_refresh(), + metoffice_daily_coordinator.async_config_entry_first_refresh(), ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)