Skip to content

Commit

Permalink
Merge pull request finish06#15 from xaviertorras/master
Browse files Browse the repository at this point in the history
Get Alerts And Arhive all Alerts
  • Loading branch information
calmh committed Jun 15, 2014
2 parents 99acc13 + 05092cc commit bb7de93
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ Disconnects a client, forcing them to reassociate. Useful when the
connection is of bad quality to force a rescan.

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

### `get_alerts(self)`

Return a list of Alerts.

### `get_aps(self)`

Expand Down Expand Up @@ -164,6 +168,10 @@ Remove a client from the block list.

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

### `archive_all_alerts(self)`

Archive all alerts of site.

### `create_backup(self)`

Tells the controller to create a backup archive that can be downloaded with download_backup() and
Expand Down
12 changes: 12 additions & 0 deletions unifi/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def _login(self):
'username': self.username, 'password': self.password})
self.opener.open(self.url + 'login', params).read()

def get_alerts(self):
"""Return a list of all Alerts."""

return self._read(self.api_url + 'list/alarm')

def get_aps(self):
"""Return a list of all AP:s, with significant information about each."""

Expand Down Expand Up @@ -188,6 +193,13 @@ def restart_ap_name(self, name):
if ap.get('state', 0) == 1 and ap.get('name', None) == name:
self.restart_ap(ap['mac'])

def archive_all_alerts(self):
"""Archive all Alerts
"""
js = json.dumps({'cmd': 'archive-all-alarms'})
params = urllib.urlencode({'json': js})
answer = self._read(self.api_url + 'cmd/evtmgr', params)

def create_backup(self):
"""Ask controller to create a backup archive file, response contains the path to the backup file.
Expand Down

0 comments on commit bb7de93

Please sign in to comment.