Skip to content
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

Add forget_client (using forget_sta api) #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ Remove a client from the block list.

- `mac` -- the MAC address of the client to unblock.

### `forget_client(self, macs)`

Forget one or more clients.

- `macs` -- a list of one or more MAC addresses of the clients to forget, e.g. ['00:00:00:00:00:01', '00:00:00:00:00:02']

### `archive_all_alerts(self)`

Archive all alerts of site.
Expand Down
12 changes: 12 additions & 0 deletions pyunifi/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ def _mac_cmd(self, target_mac, command, mgr='stamgr', params={}):
params['mac'] = target_mac
return self._run_command(command, params, mgr)

def _macs_cmd(self, target_macs, command, mgr='stamgr', params={}):
log.debug('_mac_cmd(%s, %s)', target_macs, command)
params['macs'] = target_macs
return self._run_command(command, params, mgr)

def create_site(self, desc='desc'):
"""Create a new site.

Expand All @@ -263,6 +268,13 @@ def unblock_client(self, mac):
"""
return self._mac_cmd(mac, 'unblock-sta')

def forget_client(self, macs):
"""Forget one or more clients.

:param macs: a list of MAC addresses of the clients to forget.
"""
return self._macs_cmd(macs, 'forget-sta')

def disconnect_client(self, mac):
"""Disconnect a client.

Expand Down