Skip to content

Commit 4af3c4f

Browse files
CFennererwindouna
andauthored
Fix empty via_device in ViCare integration (#155032)
Co-authored-by: Erwin Douna <e.douna@gmail.com>
1 parent a020a32 commit 4af3c4f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

homeassistant/components/vicare/entity.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,13 @@ def __init__(
2929
gateway_serial = device_config.getConfig().serial
3030
device_id = device_config.getId()
3131
model = device_config.getModel().replace("_", " ")
32-
via_device_identifier: tuple[str, str] = ("", "")
3332

3433
identifier = (
3534
f"{gateway_serial}_{device_serial.replace('-', '_')}"
3635
if device_serial is not None
3736
else f"{gateway_serial}_{device_id}"
3837
)
3938

40-
if device_serial is not None and device_serial.startswith("zigbee-"):
41-
parts = device_serial.split("-")
42-
if len(parts) == 3: # expect format zigbee-<zigbee-ieee>-<channel-id>
43-
via_device_identifier = (DOMAIN, f"{gateway_serial}_zigbee_{parts[1]}")
44-
4539
self._api: PyViCareDevice | PyViCareHeatingDeviceComponent = (
4640
component if component else device
4741
)
@@ -56,5 +50,13 @@ def __init__(
5650
manufacturer="Viessmann",
5751
model=model,
5852
configuration_url=VIESSMANN_DEVELOPER_PORTAL,
59-
via_device=via_device_identifier,
6053
)
54+
55+
if device_serial and device_serial.startswith("zigbee-"):
56+
parts = device_serial.split("-", 2)
57+
if len(parts) == 3:
58+
_, zigbee_ieee, _ = parts
59+
self._attr_device_info["via_device"] = (
60+
DOMAIN,
61+
f"{gateway_serial}_zigbee_{zigbee_ieee}",
62+
)

0 commit comments

Comments
 (0)