From 12426dfad46251ad71981c33ef26a1385fbf9f23 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Sat, 29 Jul 2023 19:22:53 +0000 Subject: [PATCH] Add entity translations for AccuWeather (#95940) * Add entity name translations * Some improvements * Update tests * Suggested changes * day 0 -> today * night 0 -> tonight * Fix precipitation --- .../components/accuweather/sensor.py | 508 +++++++----- .../components/accuweather/strings.json | 767 ++++++++++++++++-- tests/components/accuweather/test_sensor.py | 102 +-- 3 files changed, 1066 insertions(+), 311 deletions(-) diff --git a/homeassistant/components/accuweather/sensor.py b/homeassistant/components/accuweather/sensor.py index 9eca5e772b04e0..c983f0bc2911af 100644 --- a/homeassistant/components/accuweather/sensor.py +++ b/homeassistant/components/accuweather/sensor.py @@ -59,193 +59,280 @@ class AccuWeatherSensorDescription( """Class describing AccuWeather sensor entities.""" attr_fn: Callable[[dict[str, Any]], dict[str, Any]] = lambda _: {} + day: int | None = None FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( - AccuWeatherSensorDescription( - key="AirQuality", - icon="mdi:air-filter", - name="Air quality", - value_fn=lambda data: cast(str, data[ATTR_CATEGORY]), - device_class=SensorDeviceClass.ENUM, - options=["good", "hazardous", "high", "low", "moderate", "unhealthy"], - translation_key="air_quality", - ), - AccuWeatherSensorDescription( - key="CloudCoverDay", - icon="mdi:weather-cloudy", - name="Cloud cover day", - entity_registry_enabled_default=False, - native_unit_of_measurement=PERCENTAGE, - value_fn=lambda data: cast(int, data), - ), - AccuWeatherSensorDescription( - key="CloudCoverNight", - icon="mdi:weather-cloudy", - name="Cloud cover night", - entity_registry_enabled_default=False, - native_unit_of_measurement=PERCENTAGE, - value_fn=lambda data: cast(int, data), - ), - AccuWeatherSensorDescription( - key="Grass", - icon="mdi:grass", - name="Grass pollen", - entity_registry_enabled_default=False, - native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, - value_fn=lambda data: cast(int, data[ATTR_VALUE]), - attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, - translation_key="grass_pollen", - ), - AccuWeatherSensorDescription( - key="HoursOfSun", - icon="mdi:weather-partly-cloudy", - name="Hours of sun", - native_unit_of_measurement=UnitOfTime.HOURS, - value_fn=lambda data: cast(float, data), - ), - AccuWeatherSensorDescription( - key="LongPhraseDay", - name="Condition day", - value_fn=lambda data: cast(str, data), - ), - AccuWeatherSensorDescription( - key="LongPhraseNight", - name="Condition night", - value_fn=lambda data: cast(str, data), - ), - AccuWeatherSensorDescription( - key="Mold", - icon="mdi:blur", - name="Mold pollen", - entity_registry_enabled_default=False, - native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, - value_fn=lambda data: cast(int, data[ATTR_VALUE]), - attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, - translation_key="mold_pollen", - ), - AccuWeatherSensorDescription( - key="Ragweed", - icon="mdi:sprout", - name="Ragweed pollen", - native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, - entity_registry_enabled_default=False, - value_fn=lambda data: cast(int, data[ATTR_VALUE]), - attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, - translation_key="ragweed_pollen", - ), - AccuWeatherSensorDescription( - key="RealFeelTemperatureMax", - device_class=SensorDeviceClass.TEMPERATURE, - name="RealFeel temperature max", - native_unit_of_measurement=UnitOfTemperature.CELSIUS, - value_fn=lambda data: cast(float, data[ATTR_VALUE]), - ), - AccuWeatherSensorDescription( - key="RealFeelTemperatureMin", - device_class=SensorDeviceClass.TEMPERATURE, - name="RealFeel temperature min", - native_unit_of_measurement=UnitOfTemperature.CELSIUS, - value_fn=lambda data: cast(float, data[ATTR_VALUE]), - ), - AccuWeatherSensorDescription( - key="RealFeelTemperatureShadeMax", - device_class=SensorDeviceClass.TEMPERATURE, - name="RealFeel temperature shade max", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfTemperature.CELSIUS, - value_fn=lambda data: cast(float, data[ATTR_VALUE]), - ), - AccuWeatherSensorDescription( - key="RealFeelTemperatureShadeMin", - device_class=SensorDeviceClass.TEMPERATURE, - name="RealFeel temperature shade min", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfTemperature.CELSIUS, - value_fn=lambda data: cast(float, data[ATTR_VALUE]), - ), - AccuWeatherSensorDescription( - key="SolarIrradianceDay", - icon="mdi:weather-sunny", - name="Solar irradiance day", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER, - value_fn=lambda data: cast(float, data[ATTR_VALUE]), - ), - AccuWeatherSensorDescription( - key="SolarIrradianceNight", - icon="mdi:weather-sunny", - name="Solar irradiance night", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER, - value_fn=lambda data: cast(float, data[ATTR_VALUE]), - ), - AccuWeatherSensorDescription( - key="ThunderstormProbabilityDay", - icon="mdi:weather-lightning", - name="Thunderstorm probability day", - native_unit_of_measurement=PERCENTAGE, - value_fn=lambda data: cast(int, data), - ), - AccuWeatherSensorDescription( - key="ThunderstormProbabilityNight", - icon="mdi:weather-lightning", - name="Thunderstorm probability night", - native_unit_of_measurement=PERCENTAGE, - value_fn=lambda data: cast(int, data), - ), - AccuWeatherSensorDescription( - key="Tree", - icon="mdi:tree-outline", - name="Tree pollen", - native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, - entity_registry_enabled_default=False, - value_fn=lambda data: cast(int, data[ATTR_VALUE]), - attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, - translation_key="tree_pollen", - ), - AccuWeatherSensorDescription( - key="UVIndex", - icon="mdi:weather-sunny", - name="UV index", - native_unit_of_measurement=UV_INDEX, - value_fn=lambda data: cast(int, data[ATTR_VALUE]), - attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, - translation_key="uv_index", - ), - AccuWeatherSensorDescription( - key="WindGustDay", - device_class=SensorDeviceClass.WIND_SPEED, - name="Wind gust day", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, - value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), - attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, - ), - AccuWeatherSensorDescription( - key="WindGustNight", - device_class=SensorDeviceClass.WIND_SPEED, - name="Wind gust night", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, - value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), - attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, - ), - AccuWeatherSensorDescription( - key="WindDay", - device_class=SensorDeviceClass.WIND_SPEED, - name="Wind day", - native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, - value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), - attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, - ), - AccuWeatherSensorDescription( - key="WindNight", - device_class=SensorDeviceClass.WIND_SPEED, - name="Wind night", - native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, - value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), - attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, + *( + AccuWeatherSensorDescription( + key="AirQuality", + icon="mdi:air-filter", + value_fn=lambda data: cast(str, data[ATTR_CATEGORY]), + device_class=SensorDeviceClass.ENUM, + options=["good", "hazardous", "high", "low", "moderate", "unhealthy"], + translation_key=f"air_quality_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="CloudCoverDay", + icon="mdi:weather-cloudy", + entity_registry_enabled_default=False, + native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: cast(int, data), + translation_key=f"cloud_cover_day_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="CloudCoverNight", + icon="mdi:weather-cloudy", + entity_registry_enabled_default=False, + native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: cast(int, data), + translation_key=f"cloud_cover_night_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="Grass", + icon="mdi:grass", + entity_registry_enabled_default=False, + native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, + value_fn=lambda data: cast(int, data[ATTR_VALUE]), + attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, + translation_key=f"grass_pollen_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="HoursOfSun", + icon="mdi:weather-partly-cloudy", + native_unit_of_measurement=UnitOfTime.HOURS, + value_fn=lambda data: cast(float, data), + translation_key=f"hours_of_sun_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="LongPhraseDay", + value_fn=lambda data: cast(str, data), + translation_key=f"condition_day_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="LongPhraseNight", + value_fn=lambda data: cast(str, data), + translation_key=f"condition_night_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="Mold", + icon="mdi:blur", + entity_registry_enabled_default=False, + native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, + value_fn=lambda data: cast(int, data[ATTR_VALUE]), + attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, + translation_key=f"mold_pollen_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="Ragweed", + icon="mdi:sprout", + native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, + entity_registry_enabled_default=False, + value_fn=lambda data: cast(int, data[ATTR_VALUE]), + attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, + translation_key=f"ragweed_pollen_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="RealFeelTemperatureMax", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: cast(float, data[ATTR_VALUE]), + translation_key=f"realfeel_temperature_max_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="RealFeelTemperatureMin", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: cast(float, data[ATTR_VALUE]), + translation_key=f"realfeel_temperature_min_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="RealFeelTemperatureShadeMax", + device_class=SensorDeviceClass.TEMPERATURE, + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: cast(float, data[ATTR_VALUE]), + translation_key=f"realfeel_temperature_shade_max_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="RealFeelTemperatureShadeMin", + device_class=SensorDeviceClass.TEMPERATURE, + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + value_fn=lambda data: cast(float, data[ATTR_VALUE]), + translation_key=f"realfeel_temperature_shade_min_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="SolarIrradianceDay", + icon="mdi:weather-sunny", + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER, + value_fn=lambda data: cast(float, data[ATTR_VALUE]), + translation_key=f"solar_irradiance_day_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="SolarIrradianceNight", + icon="mdi:weather-sunny", + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER, + value_fn=lambda data: cast(float, data[ATTR_VALUE]), + translation_key=f"solar_irradiance_night_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="ThunderstormProbabilityDay", + icon="mdi:weather-lightning", + native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: cast(int, data), + translation_key=f"thunderstorm_probability_day_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="ThunderstormProbabilityNight", + icon="mdi:weather-lightning", + native_unit_of_measurement=PERCENTAGE, + value_fn=lambda data: cast(int, data), + translation_key=f"thunderstorm_probability_night_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="Tree", + icon="mdi:tree-outline", + native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER, + entity_registry_enabled_default=False, + value_fn=lambda data: cast(int, data[ATTR_VALUE]), + attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, + translation_key=f"tree_pollen_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="UVIndex", + icon="mdi:weather-sunny", + native_unit_of_measurement=UV_INDEX, + value_fn=lambda data: cast(int, data[ATTR_VALUE]), + attr_fn=lambda data: {ATTR_LEVEL: data[ATTR_CATEGORY]}, + translation_key=f"uv_index_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="WindGustDay", + device_class=SensorDeviceClass.WIND_SPEED, + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, + value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), + attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, + translation_key=f"wind_gust_speed_day_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="WindGustNight", + device_class=SensorDeviceClass.WIND_SPEED, + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, + value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), + attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, + translation_key=f"wind_gust_speed_night_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="WindDay", + device_class=SensorDeviceClass.WIND_SPEED, + native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, + value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), + attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, + translation_key=f"wind_speed_day_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) + ), + *( + AccuWeatherSensorDescription( + key="WindNight", + device_class=SensorDeviceClass.WIND_SPEED, + native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, + value_fn=lambda data: cast(float, data[ATTR_SPEED][ATTR_VALUE]), + attr_fn=lambda data: {"direction": data[ATTR_DIRECTION][ATTR_ENGLISH]}, + translation_key=f"wind_speed_night_{day}d", + day=day, + ) + for day in range(MAX_FORECAST_DAYS + 1) ), ) @@ -253,118 +340,117 @@ class AccuWeatherSensorDescription( AccuWeatherSensorDescription( key="ApparentTemperature", device_class=SensorDeviceClass.TEMPERATURE, - name="Apparent temperature", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), + translation_key="apparent_temperature", ), AccuWeatherSensorDescription( key="Ceiling", device_class=SensorDeviceClass.DISTANCE, icon="mdi:weather-fog", - name="Cloud ceiling", state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfLength.METERS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), suggested_display_precision=0, + translation_key="cloud_ceiling", ), AccuWeatherSensorDescription( key="CloudCover", icon="mdi:weather-cloudy", - name="Cloud cover", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=PERCENTAGE, value_fn=lambda data: cast(int, data), + translation_key="cloud_cover", ), AccuWeatherSensorDescription( key="DewPoint", device_class=SensorDeviceClass.TEMPERATURE, - name="Dew point", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), + translation_key="dew_point", ), AccuWeatherSensorDescription( key="RealFeelTemperature", device_class=SensorDeviceClass.TEMPERATURE, - name="RealFeel temperature", state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), + translation_key="realfeel_temperature", ), AccuWeatherSensorDescription( key="RealFeelTemperatureShade", device_class=SensorDeviceClass.TEMPERATURE, - name="RealFeel temperature shade", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), + translation_key="realfeel_temperature_shade", ), AccuWeatherSensorDescription( key="Precipitation", device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, - name="Precipitation", state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), attr_fn=lambda data: {"type": data["PrecipitationType"]}, + translation_key="precipitation", ), AccuWeatherSensorDescription( key="PressureTendency", device_class=SensorDeviceClass.ENUM, icon="mdi:gauge", - name="Pressure tendency", options=["falling", "rising", "steady"], - translation_key="pressure_tendency", value_fn=lambda data: cast(str, data["LocalizedText"]).lower(), + translation_key="pressure_tendency", ), AccuWeatherSensorDescription( key="UVIndex", icon="mdi:weather-sunny", - name="UV index", state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UV_INDEX, value_fn=lambda data: cast(int, data), attr_fn=lambda data: {ATTR_LEVEL: data["UVIndexText"]}, + translation_key="uv_index", ), AccuWeatherSensorDescription( key="WetBulbTemperature", device_class=SensorDeviceClass.TEMPERATURE, - name="Wet bulb temperature", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), + translation_key="wet_bulb_temperature", ), AccuWeatherSensorDescription( key="WindChillTemperature", device_class=SensorDeviceClass.TEMPERATURE, - name="Wind chill temperature", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_fn=lambda data: cast(float, data[API_METRIC][ATTR_VALUE]), + translation_key="wind_chill_temperature", ), AccuWeatherSensorDescription( key="Wind", device_class=SensorDeviceClass.WIND_SPEED, - name="Wind", state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, value_fn=lambda data: cast(float, data[ATTR_SPEED][API_METRIC][ATTR_VALUE]), + translation_key="wind_speed", ), AccuWeatherSensorDescription( key="WindGust", device_class=SensorDeviceClass.WIND_SPEED, - name="Wind gust", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, value_fn=lambda data: cast(float, data[ATTR_SPEED][API_METRIC][ATTR_VALUE]), + translation_key="wind_gust_speed", ), ) @@ -381,14 +467,12 @@ async def async_setup_entry( ] if coordinator.forecast: - # Some air quality/allergy sensors are only available for certain - # locations. - sensors.extend( - AccuWeatherSensor(coordinator, description, forecast_day=day) - for day in range(MAX_FORECAST_DAYS + 1) - for description in FORECAST_SENSOR_TYPES - if description.key in coordinator.data[ATTR_FORECAST][0] - ) + for description in FORECAST_SENSOR_TYPES: + # Some air quality/allergy sensors are only available for certain + # locations. + if description.key not in coordinator.data[ATTR_FORECAST][description.day]: + continue + sensors.append(AccuWeatherSensor(coordinator, description)) async_add_entities(sensors) @@ -406,25 +490,21 @@ def __init__( self, coordinator: AccuWeatherDataUpdateCoordinator, description: AccuWeatherSensorDescription, - forecast_day: int | None = None, ) -> None: """Initialize.""" super().__init__(coordinator) + self.forecast_day = description.day self.entity_description = description self._sensor_data = _get_sensor_data( - coordinator.data, description.key, forecast_day + coordinator.data, description.key, self.forecast_day ) - if forecast_day is not None: - self._attr_name = f"{description.name} {forecast_day}d" - self._attr_unique_id = ( - f"{coordinator.location_key}-{description.key}-{forecast_day}".lower() - ) + if self.forecast_day is not None: + self._attr_unique_id = f"{coordinator.location_key}-{description.key}-{self.forecast_day}".lower() else: self._attr_unique_id = ( f"{coordinator.location_key}-{description.key}".lower() ) self._attr_device_info = coordinator.device_info - self.forecast_day = forecast_day @property def native_value(self) -> str | int | float | None: diff --git a/homeassistant/components/accuweather/strings.json b/homeassistant/components/accuweather/strings.json index e9c4ace9b99d56..24024ba722fbd1 100644 --- a/homeassistant/components/accuweather/strings.json +++ b/homeassistant/components/accuweather/strings.json @@ -24,14 +24,8 @@ }, "entity": { "sensor": { - "pressure_tendency": { - "state": { - "steady": "Steady", - "rising": "Rising", - "falling": "Falling" - } - }, - "air_quality": { + "air_quality_0d": { + "name": "Air quality today", "state": { "good": "Good", "hazardous": "Hazardous", @@ -41,80 +35,761 @@ "unhealthy": "Unhealthy" } }, - "grass_pollen": { + "air_quality_1d": { + "name": "Air quality day 1", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + }, + "air_quality_2d": { + "name": "Air quality day 2", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + }, + "air_quality_3d": { + "name": "Air quality day 3", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + }, + "air_quality_4d": { + "name": "Air quality day 4", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + }, + "apparent_temperature": { + "name": "Apparent temperature" + }, + "cloud_ceiling": { + "name": "Cloud ceiling" + }, + "cloud_cover": { + "name": "Cloud cover" + }, + "cloud_cover_day_0d": { + "name": "Cloud cover today" + }, + "cloud_cover_day_1d": { + "name": "Cloud cover day 1" + }, + "cloud_cover_day_2d": { + "name": "Cloud cover day 2" + }, + "cloud_cover_day_3d": { + "name": "Cloud cover day 3" + }, + "cloud_cover_day_4d": { + "name": "Cloud cover day 4" + }, + "cloud_cover_night_0d": { + "name": "Cloud cover tonight" + }, + "cloud_cover_night_1d": { + "name": "Cloud cover night 1" + }, + "cloud_cover_night_2d": { + "name": "Cloud cover night 2" + }, + "cloud_cover_night_3d": { + "name": "Cloud cover night 3" + }, + "cloud_cover_night_4d": { + "name": "Cloud cover night 4" + }, + "condition_day_0d": { + "name": "Condition today" + }, + "condition_day_1d": { + "name": "Condition day 1" + }, + "condition_day_2d": { + "name": "Condition day 2" + }, + "condition_day_3d": { + "name": "Condition day 3" + }, + "condition_day_4d": { + "name": "Condition day 4" + }, + "condition_night_0d": { + "name": "Condition tonight" + }, + "condition_night_1d": { + "name": "Condition night 1" + }, + "condition_night_2d": { + "name": "Condition night 2" + }, + "condition_night_3d": { + "name": "Condition night 3" + }, + "condition_night_4d": { + "name": "Condition night 4" + }, + "dew_point": { + "name": "Dew point" + }, + "grass_pollen_0d": { + "name": "Grass pollen today", "state_attributes": { "level": { "name": "Level", "state": { - "good": "[%key:component::accuweather::entity::sensor::air_quality::state::good%]", - "hazardous": "[%key:component::accuweather::entity::sensor::air_quality::state::hazardous%]", - "high": "[%key:component::accuweather::entity::sensor::air_quality::state::high%]", - "low": "[%key:component::accuweather::entity::sensor::air_quality::state::low%]", - "moderate": "[%key:component::accuweather::entity::sensor::air_quality::state::moderate%]", - "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality::state::unhealthy%]" + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" } } } }, - "mold_pollen": { + "grass_pollen_1d": { + "name": "Grass pollen day 1", "state_attributes": { "level": { - "name": "Level", + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", "state": { - "good": "[%key:component::accuweather::entity::sensor::air_quality::state::good%]", - "hazardous": "[%key:component::accuweather::entity::sensor::air_quality::state::hazardous%]", - "high": "[%key:component::accuweather::entity::sensor::air_quality::state::high%]", - "low": "[%key:component::accuweather::entity::sensor::air_quality::state::low%]", - "moderate": "[%key:component::accuweather::entity::sensor::air_quality::state::moderate%]", - "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality::state::unhealthy%]" + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" } } } }, - "ragweed_pollen": { + "grass_pollen_2d": { + "name": "Grass pollen day 2", "state_attributes": { "level": { - "name": "Level", + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", "state": { - "good": "[%key:component::accuweather::entity::sensor::air_quality::state::good%]", - "hazardous": "[%key:component::accuweather::entity::sensor::air_quality::state::hazardous%]", - "high": "[%key:component::accuweather::entity::sensor::air_quality::state::high%]", - "low": "[%key:component::accuweather::entity::sensor::air_quality::state::low%]", - "moderate": "[%key:component::accuweather::entity::sensor::air_quality::state::moderate%]", - "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality::state::unhealthy%]" + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" } } } }, - "tree_pollen": { + "grass_pollen_3d": { + "name": "Grass pollen day 3", "state_attributes": { "level": { - "name": "Level", + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "grass_pollen_4d": { + "name": "Grass pollen day 4", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", "state": { - "good": "[%key:component::accuweather::entity::sensor::air_quality::state::good%]", - "hazardous": "[%key:component::accuweather::entity::sensor::air_quality::state::hazardous%]", - "high": "[%key:component::accuweather::entity::sensor::air_quality::state::high%]", - "low": "[%key:component::accuweather::entity::sensor::air_quality::state::low%]", - "moderate": "[%key:component::accuweather::entity::sensor::air_quality::state::moderate%]", - "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality::state::unhealthy%]" + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "hours_of_sun_0d": { + "name": "Hours of sun today" + }, + "hours_of_sun_1d": { + "name": "Hours of sun day 1" + }, + "hours_of_sun_2d": { + "name": "Hours of sun day 2" + }, + "hours_of_sun_3d": { + "name": "Hours of sun day 3" + }, + "hours_of_sun_4d": { + "name": "Hours of sun day 4" + }, + "mold_pollen_0d": { + "name": "Mold pollen today", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "mold_pollen_1d": { + "name": "Mold pollen day 1", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "mold_pollen_2d": { + "name": "Mold pollen day 2", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "mold_pollen_3d": { + "name": "Mold pollen day 3", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "mold_pollen_4d": { + "name": "Mold pollen day 4", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "precipitation": { + "name": "[%key:component::sensor::entity_component::precipitation::name%]" + }, + "pressure_tendency": { + "name": "Pressure tendency", + "state": { + "steady": "Steady", + "rising": "Rising", + "falling": "Falling" + } + }, + "ragweed_pollen_0d": { + "name": "Ragweed pollen today", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "ragweed_pollen_1d": { + "name": "Ragweed pollen day 1", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "ragweed_pollen_2d": { + "name": "Ragweed pollen day 2", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "ragweed_pollen_3d": { + "name": "Ragweed pollen day 3", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "ragweed_pollen_4d": { + "name": "Ragweed pollen day 4", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "realfeel_temperature": { + "name": "RealFeel temperature" + }, + "realfeel_temperature_max_0d": { + "name": "RealFeel temperature max today" + }, + "realfeel_temperature_max_1d": { + "name": "RealFeel temperature max day 1" + }, + "realfeel_temperature_max_2d": { + "name": "RealFeel temperature max day 2" + }, + "realfeel_temperature_max_3d": { + "name": "RealFeel temperature max day 3" + }, + "realfeel_temperature_max_4d": { + "name": "RealFeel temperature max day 4" + }, + "realfeel_temperature_min_0d": { + "name": "RealFeel temperature min today" + }, + "realfeel_temperature_min_1d": { + "name": "RealFeel temperature min day 1" + }, + "realfeel_temperature_min_2d": { + "name": "RealFeel temperature min day 2" + }, + "realfeel_temperature_min_3d": { + "name": "RealFeel temperature min day 3" + }, + "realfeel_temperature_min_4d": { + "name": "RealFeel temperature min day 4" + }, + "realfeel_temperature_shade": { + "name": "RealFeel temperature shade" + }, + "realfeel_temperature_shade_max_0d": { + "name": "RealFeel temperature shade max today" + }, + "realfeel_temperature_shade_max_1d": { + "name": "RealFeel temperature shade max day 1" + }, + "realfeel_temperature_shade_max_2d": { + "name": "RealFeel temperature shade max day 2" + }, + "realfeel_temperature_shade_max_3d": { + "name": "RealFeel temperature shade max day 3" + }, + "realfeel_temperature_shade_max_4d": { + "name": "RealFeel temperature shade max day 4" + }, + "realfeel_temperature_shade_min_0d": { + "name": "RealFeel temperature shade min today" + }, + "realfeel_temperature_shade_min_1d": { + "name": "RealFeel temperature shade min day 1" + }, + "realfeel_temperature_shade_min_2d": { + "name": "RealFeel temperature shade min day 2" + }, + "realfeel_temperature_shade_min_3d": { + "name": "RealFeel temperature shade min day 3" + }, + "realfeel_temperature_shade_min_4d": { + "name": "RealFeel temperature shade min day 4" + }, + "solar_irradiance_day_0d": { + "name": "Solar irradiance today" + }, + "solar_irradiance_day_1d": { + "name": "Solar irradiance day 1" + }, + "solar_irradiance_day_2d": { + "name": "Solar irradiance day 2" + }, + "solar_irradiance_day_3d": { + "name": "Solar irradiance day 3" + }, + "solar_irradiance_day_4d": { + "name": "Solar irradiance day 4" + }, + "solar_irradiance_night_0d": { + "name": "Solar irradiance tonight" + }, + "solar_irradiance_night_1d": { + "name": "Solar irradiance night 1" + }, + "solar_irradiance_night_2d": { + "name": "Solar irradiance night 2" + }, + "solar_irradiance_night_3d": { + "name": "Solar irradiance night 3" + }, + "solar_irradiance_night_4d": { + "name": "Solar irradiance night 4" + }, + "thunderstorm_probability_day_0d": { + "name": "Thunderstorm probability today" + }, + "thunderstorm_probability_day_1d": { + "name": "Thunderstorm probability day 1" + }, + "thunderstorm_probability_day_2d": { + "name": "Thunderstorm probability day 2" + }, + "thunderstorm_probability_day_3d": { + "name": "Thunderstorm probability day 3" + }, + "thunderstorm_probability_day_4d": { + "name": "Thunderstorm probability day 4" + }, + "thunderstorm_probability_night_0d": { + "name": "Thunderstorm probability tonight" + }, + "thunderstorm_probability_night_1d": { + "name": "Thunderstorm probability night 1" + }, + "thunderstorm_probability_night_2d": { + "name": "Thunderstorm probability night 2" + }, + "thunderstorm_probability_night_3d": { + "name": "Thunderstorm probability night 3" + }, + "thunderstorm_probability_night_4d": { + "name": "Thunderstorm probability night 4" + }, + "tree_pollen_0d": { + "name": "Tree pollen today", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "tree_pollen_1d": { + "name": "Tree pollen day 1", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "tree_pollen_2d": { + "name": "Tree pollen day 2", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "tree_pollen_3d": { + "name": "Tree pollen day 3", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "tree_pollen_4d": { + "name": "Tree pollen day 4", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" } } } }, "uv_index": { + "name": "UV index", "state_attributes": { "level": { - "name": "Level", + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "uv_index_0d": { + "name": "UV index today", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "uv_index_1d": { + "name": "UV index day 1", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "uv_index_2d": { + "name": "UV index day 2", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "uv_index_3d": { + "name": "UV index day 3", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", "state": { - "good": "[%key:component::accuweather::entity::sensor::air_quality::state::good%]", - "hazardous": "[%key:component::accuweather::entity::sensor::air_quality::state::hazardous%]", - "high": "[%key:component::accuweather::entity::sensor::air_quality::state::high%]", - "low": "[%key:component::accuweather::entity::sensor::air_quality::state::low%]", - "moderate": "[%key:component::accuweather::entity::sensor::air_quality::state::moderate%]", - "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality::state::unhealthy%]" + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" } } } + }, + "uv_index_4d": { + "name": "UV index day 4", + "state_attributes": { + "level": { + "name": "[%key:component::accuweather::entity::sensor::grass_pollen_0d::state_attributes::level::name%]", + "state": { + "good": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::good%]", + "hazardous": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::hazardous%]", + "high": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::high%]", + "low": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::low%]", + "moderate": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::moderate%]", + "unhealthy": "[%key:component::accuweather::entity::sensor::air_quality_0d::state::unhealthy%]" + } + } + } + }, + "wet_bulb_temperature": { + "name": "Wet bulb temperature" + }, + "wind_speed": { + "name": "[%key:component::weather::entity_component::_::state_attributes::wind_speed::name%]" + }, + "wind_chill_temperature": { + "name": "Wind chill temperature" + }, + "wind_gust_speed": { + "name": "[%key:component::weather::entity_component::_::state_attributes::wind_gust_speed::name%]" + }, + "wind_gust_speed_day_0d": { + "name": "Wind gust speed today" + }, + "wind_gust_speed_day_1d": { + "name": "Wind gust speed day 1" + }, + "wind_gust_speed_day_2d": { + "name": "Wind gust speed day 2" + }, + "wind_gust_speed_day_3d": { + "name": "Wind gust speed day 3" + }, + "wind_gust_speed_day_4d": { + "name": "Wind gust speed day 4" + }, + "wind_gust_speed_night_0d": { + "name": "Wind gust speed tonight" + }, + "wind_gust_speed_night_1d": { + "name": "Wind gust speed night 1" + }, + "wind_gust_speed_night_2d": { + "name": "Wind gust speed night 2" + }, + "wind_gust_speed_night_3d": { + "name": "Wind gust speed night 3" + }, + "wind_gust_speed_night_4d": { + "name": "Wind gust speed night 4" + }, + "wind_speed_day_0d": { + "name": "Wind speed today" + }, + "wind_speed_day_1d": { + "name": "Wind speed day 1" + }, + "wind_speed_day_2d": { + "name": "Wind speed day 2" + }, + "wind_speed_day_3d": { + "name": "Wind speed day 3" + }, + "wind_speed_day_4d": { + "name": "Wind speed day 4" + }, + "wind_speed_night_0d": { + "name": "Wind speed tonight" + }, + "wind_speed_night_1d": { + "name": "Wind speed night 1" + }, + "wind_speed_night_2d": { + "name": "Wind speed night 2" + }, + "wind_speed_night_3d": { + "name": "Wind speed night 3" + }, + "wind_speed_night_4d": { + "name": "Wind speed night 4" } } }, diff --git a/tests/components/accuweather/test_sensor.py b/tests/components/accuweather/test_sensor.py index 35f86bdb039f41..a7a94894be4013 100644 --- a/tests/components/accuweather/test_sensor.py +++ b/tests/components/accuweather/test_sensor.py @@ -192,7 +192,7 @@ async def test_sensor_without_forecast( assert entry assert entry.unique_id == "0123456-windchilltemperature" - state = hass.states.get("sensor.home_wind_gust") + state = hass.states.get("sensor.home_wind_gust_speed") assert state assert state.state == "20.3" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -204,11 +204,11 @@ async def test_sensor_without_forecast( assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED - entry = registry.async_get("sensor.home_wind_gust") + entry = registry.async_get("sensor.home_wind_gust_speed") assert entry assert entry.unique_id == "0123456-windgust" - state = hass.states.get("sensor.home_wind") + state = hass.states.get("sensor.home_wind_speed") assert state assert state.state == "14.5" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -220,7 +220,7 @@ async def test_sensor_without_forecast( assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED - entry = registry.async_get("sensor.home_wind") + entry = registry.async_get("sensor.home_wind_speed") assert entry assert entry.unique_id == "0123456-wind" @@ -232,7 +232,7 @@ async def test_sensor_with_forecast( await init_integration(hass, forecast=True) registry = er.async_get(hass) - state = hass.states.get("sensor.home_hours_of_sun_0d") + state = hass.states.get("sensor.home_hours_of_sun_today") assert state assert state.state == "7.2" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -240,11 +240,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTime.HOURS assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_hours_of_sun_0d") + entry = registry.async_get("sensor.home_hours_of_sun_today") assert entry assert entry.unique_id == "0123456-hoursofsun-0" - state = hass.states.get("sensor.home_realfeel_temperature_max_0d") + state = hass.states.get("sensor.home_realfeel_temperature_max_today") assert state assert state.state == "29.8" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -252,10 +252,10 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TEMPERATURE assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_realfeel_temperature_max_0d") + entry = registry.async_get("sensor.home_realfeel_temperature_max_today") assert entry - state = hass.states.get("sensor.home_realfeel_temperature_min_0d") + state = hass.states.get("sensor.home_realfeel_temperature_min_today") assert state assert state.state == "15.1" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -263,11 +263,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TEMPERATURE assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_realfeel_temperature_min_0d") + entry = registry.async_get("sensor.home_realfeel_temperature_min_today") assert entry assert entry.unique_id == "0123456-realfeeltemperaturemin-0" - state = hass.states.get("sensor.home_thunderstorm_probability_day_0d") + state = hass.states.get("sensor.home_thunderstorm_probability_today") assert state assert state.state == "40" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -275,11 +275,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_thunderstorm_probability_day_0d") + entry = registry.async_get("sensor.home_thunderstorm_probability_today") assert entry assert entry.unique_id == "0123456-thunderstormprobabilityday-0" - state = hass.states.get("sensor.home_thunderstorm_probability_night_0d") + state = hass.states.get("sensor.home_thunderstorm_probability_tonight") assert state assert state.state == "40" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -287,11 +287,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_thunderstorm_probability_night_0d") + entry = registry.async_get("sensor.home_thunderstorm_probability_tonight") assert entry assert entry.unique_id == "0123456-thunderstormprobabilitynight-0" - state = hass.states.get("sensor.home_uv_index_0d") + state = hass.states.get("sensor.home_uv_index_today") assert state assert state.state == "5" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -300,11 +300,11 @@ async def test_sensor_with_forecast( assert state.attributes.get("level") == "moderate" assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_uv_index_0d") + entry = registry.async_get("sensor.home_uv_index_today") assert entry assert entry.unique_id == "0123456-uvindex-0" - state = hass.states.get("sensor.home_air_quality_0d") + state = hass.states.get("sensor.home_air_quality_today") assert state assert state.state == "good" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -319,7 +319,7 @@ async def test_sensor_with_forecast( "unhealthy", ] - state = hass.states.get("sensor.home_cloud_cover_day_0d") + state = hass.states.get("sensor.home_cloud_cover_today") assert state assert state.state == "58" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -327,11 +327,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_ICON) == "mdi:weather-cloudy" assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_cloud_cover_day_0d") + entry = registry.async_get("sensor.home_cloud_cover_today") assert entry assert entry.unique_id == "0123456-cloudcoverday-0" - state = hass.states.get("sensor.home_cloud_cover_night_0d") + state = hass.states.get("sensor.home_cloud_cover_tonight") assert state assert state.state == "65" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -339,10 +339,10 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_ICON) == "mdi:weather-cloudy" assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_cloud_cover_night_0d") + entry = registry.async_get("sensor.home_cloud_cover_tonight") assert entry - state = hass.states.get("sensor.home_grass_pollen_0d") + state = hass.states.get("sensor.home_grass_pollen_today") assert state assert state.state == "0" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -354,11 +354,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_ICON) == "mdi:grass" assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_grass_pollen_0d") + entry = registry.async_get("sensor.home_grass_pollen_today") assert entry assert entry.unique_id == "0123456-grass-0" - state = hass.states.get("sensor.home_mold_pollen_0d") + state = hass.states.get("sensor.home_mold_pollen_today") assert state assert state.state == "0" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -369,11 +369,11 @@ async def test_sensor_with_forecast( assert state.attributes.get("level") == "low" assert state.attributes.get(ATTR_ICON) == "mdi:blur" - entry = registry.async_get("sensor.home_mold_pollen_0d") + entry = registry.async_get("sensor.home_mold_pollen_today") assert entry assert entry.unique_id == "0123456-mold-0" - state = hass.states.get("sensor.home_ragweed_pollen_0d") + state = hass.states.get("sensor.home_ragweed_pollen_today") assert state assert state.state == "0" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -384,11 +384,11 @@ async def test_sensor_with_forecast( assert state.attributes.get("level") == "low" assert state.attributes.get(ATTR_ICON) == "mdi:sprout" - entry = registry.async_get("sensor.home_ragweed_pollen_0d") + entry = registry.async_get("sensor.home_ragweed_pollen_today") assert entry assert entry.unique_id == "0123456-ragweed-0" - state = hass.states.get("sensor.home_realfeel_temperature_shade_max_0d") + state = hass.states.get("sensor.home_realfeel_temperature_shade_max_today") assert state assert state.state == "28.0" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -396,22 +396,22 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TEMPERATURE assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_realfeel_temperature_shade_max_0d") + entry = registry.async_get("sensor.home_realfeel_temperature_shade_max_today") assert entry assert entry.unique_id == "0123456-realfeeltemperatureshademax-0" - state = hass.states.get("sensor.home_realfeel_temperature_shade_min_0d") + state = hass.states.get("sensor.home_realfeel_temperature_shade_min_today") assert state assert state.state == "15.1" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTemperature.CELSIUS assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TEMPERATURE - entry = registry.async_get("sensor.home_realfeel_temperature_shade_min_0d") + entry = registry.async_get("sensor.home_realfeel_temperature_shade_min_today") assert entry assert entry.unique_id == "0123456-realfeeltemperatureshademin-0" - state = hass.states.get("sensor.home_tree_pollen_0d") + state = hass.states.get("sensor.home_tree_pollen_today") assert state assert state.state == "0" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -423,11 +423,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_ICON) == "mdi:tree-outline" assert state.attributes.get(ATTR_STATE_CLASS) is None - entry = registry.async_get("sensor.home_tree_pollen_0d") + entry = registry.async_get("sensor.home_tree_pollen_today") assert entry assert entry.unique_id == "0123456-tree-0" - state = hass.states.get("sensor.home_wind_day_0d") + state = hass.states.get("sensor.home_wind_speed_today") assert state assert state.state == "13.0" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -439,11 +439,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_ICON) is None assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED - entry = registry.async_get("sensor.home_wind_day_0d") + entry = registry.async_get("sensor.home_wind_speed_today") assert entry assert entry.unique_id == "0123456-windday-0" - state = hass.states.get("sensor.home_wind_night_0d") + state = hass.states.get("sensor.home_wind_speed_tonight") assert state assert state.state == "7.4" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -456,11 +456,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_STATE_CLASS) is None assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED - entry = registry.async_get("sensor.home_wind_night_0d") + entry = registry.async_get("sensor.home_wind_speed_tonight") assert entry assert entry.unique_id == "0123456-windnight-0" - state = hass.states.get("sensor.home_wind_gust_day_0d") + state = hass.states.get("sensor.home_wind_gust_speed_today") assert state assert state.state == "29.6" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -473,11 +473,11 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_STATE_CLASS) is None assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED - entry = registry.async_get("sensor.home_wind_gust_day_0d") + entry = registry.async_get("sensor.home_wind_gust_speed_today") assert entry assert entry.unique_id == "0123456-windgustday-0" - state = hass.states.get("sensor.home_wind_gust_night_0d") + state = hass.states.get("sensor.home_wind_gust_speed_tonight") assert state assert state.state == "18.5" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -490,15 +490,15 @@ async def test_sensor_with_forecast( assert state.attributes.get(ATTR_STATE_CLASS) is None assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED - entry = registry.async_get("sensor.home_wind_gust_night_0d") + entry = registry.async_get("sensor.home_wind_gust_speed_tonight") assert entry assert entry.unique_id == "0123456-windgustnight-0" - entry = registry.async_get("sensor.home_air_quality_0d") + entry = registry.async_get("sensor.home_air_quality_today") assert entry assert entry.unique_id == "0123456-airquality-0" - state = hass.states.get("sensor.home_solar_irradiance_day_0d") + state = hass.states.get("sensor.home_solar_irradiance_today") assert state assert state.state == "7447.1" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -508,11 +508,11 @@ async def test_sensor_with_forecast( == UnitOfIrradiance.WATTS_PER_SQUARE_METER ) - entry = registry.async_get("sensor.home_solar_irradiance_day_0d") + entry = registry.async_get("sensor.home_solar_irradiance_today") assert entry assert entry.unique_id == "0123456-solarirradianceday-0" - state = hass.states.get("sensor.home_solar_irradiance_night_0d") + state = hass.states.get("sensor.home_solar_irradiance_tonight") assert state assert state.state == "271.6" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION @@ -522,11 +522,11 @@ async def test_sensor_with_forecast( == UnitOfIrradiance.WATTS_PER_SQUARE_METER ) - entry = registry.async_get("sensor.home_solar_irradiance_night_0d") + entry = registry.async_get("sensor.home_solar_irradiance_tonight") assert entry assert entry.unique_id == "0123456-solarirradiancenight-0" - state = hass.states.get("sensor.home_condition_day_0d") + state = hass.states.get("sensor.home_condition_today") assert state assert ( state.state @@ -534,16 +534,16 @@ async def test_sensor_with_forecast( ) assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION - entry = registry.async_get("sensor.home_condition_day_0d") + entry = registry.async_get("sensor.home_condition_today") assert entry assert entry.unique_id == "0123456-longphraseday-0" - state = hass.states.get("sensor.home_condition_night_0d") + state = hass.states.get("sensor.home_condition_tonight") assert state assert state.state == "Partly cloudy" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION - entry = registry.async_get("sensor.home_condition_night_0d") + entry = registry.async_get("sensor.home_condition_tonight") assert entry assert entry.unique_id == "0123456-longphrasenight-0" @@ -629,7 +629,7 @@ async def test_sensor_imperial_units(hass: HomeAssistant) -> None: assert state.state == "10498.687664042" assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfLength.FEET - state = hass.states.get("sensor.home_wind") + state = hass.states.get("sensor.home_wind_speed") assert state assert state.state == "9.0" assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfSpeed.MILES_PER_HOUR