Fix empty via_device in ViCare integration (#155032)

Co-authored-by: Erwin Douna <e.douna@gmail.com>
This commit is contained in:
Christopher Fenner
2025-10-23 17:35:42 +02:00
committed by GitHub
co-authored by Erwin Douna
parent a020a32d8a
commit 4af3c4f720
+9 -7
View File
@@ -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-<zigbee-ieee>-<channel-id>
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}",
)