@@ -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 } { 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_ieee }  ,
62+                 )
0 commit comments