Fix unique_id in config validation for legacy weather platform (#149742)

This commit is contained in:
Petro31 2025-07-31 09:19:37 -04:00 committed by GitHub
parent 3d744f032f
commit 04fb86b4ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,7 @@ from homeassistant.components.weather import (
from homeassistant.const import (
CONF_NAME,
CONF_TEMPERATURE_UNIT,
CONF_UNIQUE_ID,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
@ -151,6 +152,7 @@ PLATFORM_SCHEMA = vol.Schema(
vol.Optional(CONF_PRESSURE_UNIT): vol.In(PressureConverter.VALID_UNITS),
vol.Required(CONF_TEMPERATURE_TEMPLATE): cv.template,
vol.Optional(CONF_TEMPERATURE_UNIT): vol.In(TemperatureConverter.VALID_UNITS),
vol.Optional(CONF_UNIQUE_ID): cv.string,
vol.Optional(CONF_VISIBILITY_TEMPLATE): cv.template,
vol.Optional(CONF_VISIBILITY_UNIT): vol.In(DistanceConverter.VALID_UNITS),
vol.Optional(CONF_WIND_BEARING_TEMPLATE): cv.template,

View File

@ -132,6 +132,7 @@ async def setup_weather(
{
"platform": "template",
"name": "test",
"unique_id": "abc123",
"attribution_template": "{{ states('sensor.attribution') }}",
"condition_template": "sunny",
"temperature_template": "{{ states('sensor.temperature') | float }}",