mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Fix field validation for mqtt subentry options in sections (#144355)
This commit is contained in:
parent
65278100a0
commit
358d904c2c
@ -526,8 +526,7 @@ def validate_light_platform_config(user_data: dict[str, Any]) -> dict[str, str]:
|
|||||||
if user_data.get(CONF_MIN_KELVIN, DEFAULT_MIN_KELVIN) >= user_data.get(
|
if user_data.get(CONF_MIN_KELVIN, DEFAULT_MIN_KELVIN) >= user_data.get(
|
||||||
CONF_MAX_KELVIN, DEFAULT_MAX_KELVIN
|
CONF_MAX_KELVIN, DEFAULT_MAX_KELVIN
|
||||||
):
|
):
|
||||||
errors[CONF_MAX_KELVIN] = "max_below_min_kelvin"
|
errors["advanced_settings"] = "max_below_min_kelvin"
|
||||||
errors[CONF_MIN_KELVIN] = "max_below_min_kelvin"
|
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
|
|
||||||
@ -1381,7 +1380,10 @@ def validate_user_input(
|
|||||||
try:
|
try:
|
||||||
validator(value)
|
validator(value)
|
||||||
except (ValueError, vol.Error, vol.Invalid):
|
except (ValueError, vol.Error, vol.Invalid):
|
||||||
errors[field] = data_schema_fields[field].error or "invalid_input"
|
data_schema_field = data_schema_fields[field]
|
||||||
|
errors[data_schema_field.section or field] = (
|
||||||
|
data_schema_field.error or "invalid_input"
|
||||||
|
)
|
||||||
|
|
||||||
if config_validator is not None:
|
if config_validator is not None:
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -2858,14 +2858,22 @@ async def test_migrate_of_incompatible_config_entry(
|
|||||||
},
|
},
|
||||||
{"state_topic": "invalid_subscribe_topic"},
|
{"state_topic": "invalid_subscribe_topic"},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
{
|
||||||
|
"command_topic": "test-topic",
|
||||||
|
"light_brightness_settings": {
|
||||||
|
"brightness_command_topic": "test-topic#invalid"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"light_brightness_settings": "invalid_publish_topic"},
|
||||||
|
),
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
"command_topic": "test-topic",
|
"command_topic": "test-topic",
|
||||||
"advanced_settings": {"max_kelvin": 2000, "min_kelvin": 2000},
|
"advanced_settings": {"max_kelvin": 2000, "min_kelvin": 2000},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"max_kelvin": "max_below_min_kelvin",
|
"advanced_settings": "max_below_min_kelvin",
|
||||||
"min_kelvin": "max_below_min_kelvin",
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user