Skip to content

Commit a911f59

Browse files
committed
add ip to log
1 parent bf505c9 commit a911f59

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

matter_server/server/device_controller.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1073,23 +1073,31 @@ async def _setup_node(self, node_id: int) -> None:
10731073
def log_node_long_setup(time_start: float) -> None:
10741074
"""Temporary measure to track a locked-up SDK issue in some (special) circumstances."""
10751075
time_mins = int((time.time() - time_start) / 60)
1076+
if TYPE_CHECKING:
1077+
assert self.server.loop
1078+
assert self.chip_controller
1079+
# get productlabel or modelname from raw attributes
10761080
node_model = node_data.attributes.get(
10771081
"0/40/14", node_data.attributes.get("0/40/3", "")
10781082
)
10791083
node_name = f"Node {node_id} ({node_model})"
1084+
# get current IP the sdk is using to communicate with the device
1085+
if sdk_ip_info := self.chip_controller.GetAddressAndPort(node_id):
1086+
ip_address = sdk_ip_info[0]
1087+
else:
1088+
ip_address = "unknown"
10801089

10811090
node_logger.error(
10821091
f"\n\nATTENTION: {node_name} did not complete setup in {time_mins} minutes.\n" # noqa: G004
10831092
"This is an indication of a (connectivity) issue with this device. \n"
1093+
f"IP-address in use for this device: {ip_address}\n"
10841094
"Try powercycling this device and/or relocate it closer to a Border Router or \n"
10851095
"WiFi Access Point. If this issue persists, please create an issue report on \n"
10861096
"the Matter channel of the Home Assistant Discord server or on Github:\n"
10871097
"https://github.com/home-assistant/core/issues/new?assignees=&labels="
10881098
"integration%3A%20matter&projects=&template=bug_report.yml\n",
10891099
)
10901100
# reschedule itself
1091-
if TYPE_CHECKING:
1092-
assert self.server.loop
10931101
log_timers[node_id] = self.server.loop.call_later(
10941102
15 * 60, log_node_long_setup, time_start
10951103
)

0 commit comments

Comments
 (0)