mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Zeroconf lowercase (#44675)
This commit is contained in:
@@ -33,6 +33,22 @@ def documentation_url(value: str) -> str:
|
||||
return value
|
||||
|
||||
|
||||
def verify_lowercase(value: str):
|
||||
"""Verify a value is lowercase."""
|
||||
if value.lower() != value:
|
||||
raise vol.Invalid("Value needs to be lowercase")
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def verify_uppercase(value: str):
|
||||
"""Verify a value is uppercase."""
|
||||
if value.upper() != value:
|
||||
raise vol.Invalid("Value needs to be uppercase")
|
||||
|
||||
return value
|
||||
|
||||
|
||||
MANIFEST_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required("domain"): str,
|
||||
@@ -45,8 +61,8 @@ MANIFEST_SCHEMA = vol.Schema(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required("type"): str,
|
||||
vol.Optional("macaddress"): str,
|
||||
vol.Optional("name"): str,
|
||||
vol.Optional("macaddress"): vol.All(str, verify_uppercase),
|
||||
vol.Optional("name"): vol.All(str, verify_lowercase),
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user