Fix unique id issue for OpenWeatherMap (#74335)

This commit is contained in:
G Johansson 2022-07-03 22:53:44 +02:00 committed by Paulus Schoutsen
parent fe437cc9b7
commit 2a1a6301a9

View file

@ -22,10 +22,6 @@ from homeassistant.components.weather import (
ATTR_CONDITION_WINDY, ATTR_CONDITION_WINDY,
ATTR_CONDITION_WINDY_VARIANT, ATTR_CONDITION_WINDY_VARIANT,
ATTR_FORECAST_CONDITION, ATTR_FORECAST_CONDITION,
ATTR_FORECAST_NATIVE_PRECIPITATION,
ATTR_FORECAST_NATIVE_PRESSURE,
ATTR_FORECAST_NATIVE_TEMP,
ATTR_FORECAST_NATIVE_TEMP_LOW,
ATTR_FORECAST_PRECIPITATION_PROBABILITY, ATTR_FORECAST_PRECIPITATION_PROBABILITY,
ATTR_FORECAST_TIME, ATTR_FORECAST_TIME,
) )
@ -72,6 +68,11 @@ ATTR_API_FORECAST = "forecast"
UPDATE_LISTENER = "update_listener" UPDATE_LISTENER = "update_listener"
PLATFORMS = [Platform.SENSOR, Platform.WEATHER] PLATFORMS = [Platform.SENSOR, Platform.WEATHER]
ATTR_FORECAST_PRECIPITATION = "precipitation"
ATTR_FORECAST_PRESSURE = "pressure"
ATTR_FORECAST_TEMP = "temperature"
ATTR_FORECAST_TEMP_LOW = "templow"
FORECAST_MODE_HOURLY = "hourly" FORECAST_MODE_HOURLY = "hourly"
FORECAST_MODE_DAILY = "daily" FORECAST_MODE_DAILY = "daily"
FORECAST_MODE_FREE_DAILY = "freedaily" FORECAST_MODE_FREE_DAILY = "freedaily"
@ -266,7 +267,7 @@ FORECAST_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
name="Condition", name="Condition",
), ),
SensorEntityDescription( SensorEntityDescription(
key=ATTR_FORECAST_NATIVE_PRECIPITATION, key=ATTR_FORECAST_PRECIPITATION,
name="Precipitation", name="Precipitation",
native_unit_of_measurement=LENGTH_MILLIMETERS, native_unit_of_measurement=LENGTH_MILLIMETERS,
), ),
@ -276,19 +277,19 @@ FORECAST_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=ATTR_FORECAST_NATIVE_PRESSURE, key=ATTR_FORECAST_PRESSURE,
name="Pressure", name="Pressure",
native_unit_of_measurement=PRESSURE_HPA, native_unit_of_measurement=PRESSURE_HPA,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=ATTR_FORECAST_NATIVE_TEMP, key=ATTR_FORECAST_TEMP,
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=ATTR_FORECAST_NATIVE_TEMP_LOW, key=ATTR_FORECAST_TEMP_LOW,
name="Temperature Low", name="Temperature Low",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,