diff --git a/homeassistant/components/vicare/entity.py b/homeassistant/components/vicare/entity.py index 8de008f602ce..6dd986c3e241 100644 --- a/homeassistant/components/vicare/entity.py +++ b/homeassistant/components/vicare/entity.py @@ -29,7 +29,6 @@ class ViCareEntity(Entity): gateway_serial = device_config.getConfig().serial device_id = device_config.getId() model = device_config.getModel().replace("_", " ") - via_device_identifier: tuple[str, str] = ("", "") identifier = ( f"{gateway_serial}_{device_serial.replace('-', '_')}" @@ -37,11 +36,6 @@ class ViCareEntity(Entity): else f"{gateway_serial}_{device_id}" ) - if device_serial is not None and device_serial.startswith("zigbee-"): - parts = device_serial.split("-") - if len(parts) == 3: # expect format zigbee-- - via_device_identifier = (DOMAIN, f"{gateway_serial}_zigbee_{parts[1]}") - self._api: PyViCareDevice | PyViCareHeatingDeviceComponent = ( component if component else device ) @@ -56,5 +50,13 @@ class ViCareEntity(Entity): manufacturer="Viessmann", model=model, configuration_url=VIESSMANN_DEVELOPER_PORTAL, - via_device=via_device_identifier, ) + + if device_serial and device_serial.startswith("zigbee-"): + parts = device_serial.split("-", 2) + if len(parts) == 3: + _, zigbee_ieee, _ = parts + self._attr_device_info["via_device"] = ( + DOMAIN, + f"{gateway_serial}_zigbee_{zigbee_ieee}", + )