diff --git a/homeassistant/helpers/service_info/dhcp.py b/homeassistant/helpers/service_info/dhcp.py index d46c7a59004..94441749c65 100644 --- a/homeassistant/helpers/service_info/dhcp.py +++ b/homeassistant/helpers/service_info/dhcp.py @@ -18,3 +18,9 @@ class DhcpServiceInfo(BaseServiceInfo): as a lowercase string without colons. eg. "AA:BB:CC:12:34:56" is stored as "aabbcc123456" """ + + def __post_init__(self) -> None: + """Post-init processing.""" + # Ensure macaddress is always a lowercase string without colons + if self.macaddress != self.macaddress.lower().replace(":", ""): + raise ValueError("macaddress is not correctly formatted")