File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 88from typing import Optional , Dict
99
1010from zeroconf import Zeroconf , ServiceInfo
11+ from .utils import util
1112
1213
1314logger = logging .getLogger ("Supervisor" )
@@ -84,13 +85,21 @@ def start(self, ip_address: str) -> bool:
8485 service_name = self ._service_name_template .format (mac = mac_address )
8586 logger .debug (f"Generated service name: { service_name } (MAC: { mac_address } )" )
8687
88+ # Merge properties and add zigbee2mqtt port if service is running
89+ properties : Dict [str , str ] = dict (self ._properties )
90+ try :
91+ if util .is_service_running ("zigbee2mqtt.service" ):
92+ properties ["zigbee2mqtt_port" ] = "8099"
93+ except Exception as e :
94+ logger .warning (f"Failed checking zigbee2mqtt service status: { e } " )
95+
8796 try :
8897 info = ServiceInfo (
8998 type_ = self ._service_type ,
9099 name = service_name ,
91100 addresses = [addr_bytes ],
92101 port = self ._service_port ,
93- properties = self . _properties ,
102+ properties = properties ,
94103 server = service_name ,
95104 weight = 0 ,
96105 priority = 0 ,
You can’t perform that action at this time.
0 commit comments