nickovs / unificontrol

A high-level Python interface to the Unifi controller software
Apache License 2.0
96 stars 41 forks source link

Feature request #14

Closed menvol3 closed 3 years ago

menvol3 commented 3 years ago

Hi, currently I’m using get_client_details method to receive data for client specified by mac.

But in my case i didn’t receive data that i need, specifically Port information per client.

I attached screenshot about what i mean.

Is it possible to parse it with your tool ?

nickovs commented 3 years ago

The underlying Unifi API provides the details that you need using the list_clients() call, rather than needing to ask for more details with get_client_details(). You can optionally specify a client_mac value to list_clients() to get the information about a single client device. If is_wired is set to True in the reply then there will be fields for sw_mac and sw_port showing the MAC address of the switch into which the client is plugged and port on that switch. You can then use use list_devices(device_mac=...) to get the details of the switch and thus find its name.

I hope this helps. The API here is a wrapper on the underlying API provided by Ubiquiti, so we have to put up with the call semantics they provide, even when they are counterintuitive.