vrachieru / asuswrt-api

Asus WRT (Wireless RouTer) API wrapper.
22 stars 13 forks source link

Limiting API response #2

Closed jLynx closed 4 years ago

jLynx commented 4 years ago

Is there a way to just return the IP address based on a passed mac addres with the API directly?

The reason being is I am using this on a micro controller and right now the data it sends back is too much for it to handle, so I am wanting to limit the payload returned

Something like get_clientlist, but maybe get_clientlistbymac(00:00:00.....)

vrachieru commented 4 years ago

Hi @jLynx ,

I think what you're trying to achieve could be done in the lines of:

def find_client_ip_by_mac(self, mac):
  return self.get_online_clients()
      .get(mac, {})
      .get('ip')

As far as I'm aware there is no function inside the router itself to query the NVRAM by mac (get_clientlistbymac as you suggested).

You said you're running this on a microcoltroller so you're using micropython?