From ef48aef24aa65186ca13911cfb2f409bfdd7c6b8 Mon Sep 17 00:00:00 2001 From: peterbaumert Date: Mon, 24 Jan 2022 11:21:31 +0100 Subject: [PATCH] properly add neighbours to right object (#34) --- unifi_respondd/respondd_client.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/unifi_respondd/respondd_client.py b/unifi_respondd/respondd_client.py index b868ccc..7b7932c 100644 --- a/unifi_respondd/respondd_client.py +++ b/unifi_respondd/respondd_client.py @@ -305,22 +305,16 @@ def getNeighbours(self): aps = self._aps neighbours = [] for ap in aps.accesspoints: + nbs = {} for neighbour_mac in ap.neighbour_macs: if neighbour_mac is not None: - neighbours.append( - NeighboursInfo( - node_id=ap.mac.replace(":", ""), - batadv={ - ap.mac: Neighbours( - neighbours={ - neighbour_mac: NeighbourDetails( - tq=255, lastseen=0.45 - ) - } - ) - }, - ) - ) + nbs[neighbour_mac] = NeighbourDetails(tq=255, lastseen=0.45) + neighbours.append( + NeighboursInfo( + node_id=ap.mac.replace(":", ""), + batadv={ap.mac: Neighbours(neighbours=nbs)}, + ) + ) return neighbours def listenMulticast(self):