Skip to content

Commit 04fb86b

Browse files
authored
Fix unique_id in config validation for legacy weather platform (home-assistant#149742)
1 parent 3d744f0 commit 04fb86b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

homeassistant/components/template/weather.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from homeassistant.const import (
3535
CONF_NAME,
3636
CONF_TEMPERATURE_UNIT,
37+
CONF_UNIQUE_ID,
3738
STATE_UNAVAILABLE,
3839
STATE_UNKNOWN,
3940
)
@@ -151,6 +152,7 @@
151152
vol.Optional(CONF_PRESSURE_UNIT): vol.In(PressureConverter.VALID_UNITS),
152153
vol.Required(CONF_TEMPERATURE_TEMPLATE): cv.template,
153154
vol.Optional(CONF_TEMPERATURE_UNIT): vol.In(TemperatureConverter.VALID_UNITS),
155+
vol.Optional(CONF_UNIQUE_ID): cv.string,
154156
vol.Optional(CONF_VISIBILITY_TEMPLATE): cv.template,
155157
vol.Optional(CONF_VISIBILITY_UNIT): vol.In(DistanceConverter.VALID_UNITS),
156158
vol.Optional(CONF_WIND_BEARING_TEMPLATE): cv.template,

tests/components/template/test_weather.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ async def setup_weather(
132132
{
133133
"platform": "template",
134134
"name": "test",
135+
"unique_id": "abc123",
135136
"attribution_template": "{{ states('sensor.attribution') }}",
136137
"condition_template": "sunny",
137138
"temperature_template": "{{ states('sensor.temperature') | float }}",

0 commit comments

Comments
 (0)