Skip to content

Add extended client info, block/unblock client by mac address functions #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions omada/omada.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ def __geterator(self, path, params={}, data=None, json=None):
def __warn(self, message, category=None, stacklevel=1, source=None):
if self.warnings: warnings.warn( message, category, stacklevel, source )

##
## Replace any colons with dashes in supplied mac addresses
##
def __macConverter(self, mac = ""):
return mac.replace(':','-')

##
## Get OmadacId to prefix request. (Required for version 5.)
##
Expand Down Expand Up @@ -435,6 +441,30 @@ def getSiteDevices(self, site=None):
def getSiteClients(self, site=None):
return self.__geterator( f'/sites/{self.__findKey(site)}/clients', params={'filters.active':'true'} )

##
## Get client list from insights (also includes disconnected but seen ones)
##
def getSiteKnownClients(self, site=None):
return self.__geterator( f'/sites/{self.__findKey(site)}/insight/clients' )

##
## Gets client details
##
def getSiteClientDetails(self, site=None, client_mac=''):
return self.__get( f'/sites/{self.__findKey(site)}/clients/{self.__macConverter(client_mac)}', params={'filters.active':'true'} )

##
## Block client by mac address
##
def blockClient(self, site=None, client_mac=''):
return self.__post( f'/sites/{self.__findKey(site)}/cmd/clients/{self.__macConverter(client_mac)}/block')

##
## Unblock client by mac address
##
def unblockClient(self, site=None, client_mac=''):
return self.__post( f'/sites/{self.__findKey(site)}/cmd/clients/{self.__macConverter(client_mac)}/unblock')

##
## Returns the list of alerts for given site.
##
Expand Down