Skip to content

Commit

Permalink
Update sample scripts for v3 support and their documentation
Browse files Browse the repository at this point in the history
Now that we support v3, we should update the sample scripts to reflect that.

The documentation shows examples for v3, though v2 usage should remain working,
as long as v2 is the assumed default version.
  • Loading branch information
matsimon committed Sep 25, 2013
1 parent 0f12820 commit 7bb08f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ The following small utilities are bundled with the API:
### unifi-ls-clients

Lists the currently active clients on the networks. Takes parameters for
controller, username, password.
controller, username, password, controller version and site ID (UniFi >= 3.x)

```
jb@unifi:~ % unifi-ls-clients -c localhost -u admin -p p4ssw0rd
jb@unifi:~ % unifi-ls-clients -c localhost -u admin -p p4ssw0rd -v v3 -s default
NAME MAC AP CHAN RSSI RX TX
client-kitchen 00:24:36:9a:0d:ab Study 100 51 300 216
jborg-mbp 28:cf:da:d6:46:20 Study 100 45 300 300
Expand All @@ -41,7 +41,7 @@ According to that, an SNR of 15 dB seems like a good cutoff, and that's also
the default value in the script. You can set a higher value for testing:

```
jb@unifi:~ % unifi-low-snr-reconnect -c localhost -u admin -p p4ssw0rd --minsnr 30
jb@unifi:~ % unifi-low-snr-reconnect -c localhost -u admin -p p4ssw0rd -v v3 -s default --minsnr 30
2012-11-15 11:23:01 INFO unifi-low-snr-reconnect: Disconnecting jb-ipad/1c:ab:a7:af:05:65@Study (SNR 22 dB < 30 dB)
2012-11-15 11:23:01 INFO unifi-low-snr-reconnect: Disconnecting Annas-Iphone/74:e2:f5:97:da:7e@Living Room (SNR 29 dB < 30 dB)
```
Expand Down
4 changes: 3 additions & 1 deletion unifi-log-roaming
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ parser = argparse.ArgumentParser()
parser.add_argument('-c', '--controller', default='unifi', help='the controller address (default "unifi")')
parser.add_argument('-u', '--username', default='admin', help='the controller usernane (default "admin")')
parser.add_argument('-p', '--password', default='', help='the controller password')
parser.add_argument('-v', '--version', default='v2', help='the controller base version (default "v2")')
parser.add_argument('-s', '--siteid', default='default', help='the site ID, UniFi >=3.x only (default "default")')
args = parser.parse_args()

c = Controller(args.controller, args.username, args.password)
c = Controller(args.controller, args.username, args.password, args.version, args.siteid)

aps = c.get_aps()
ap_names = dict([(ap['mac'], ap['name']) for ap in aps])
Expand Down
4 changes: 3 additions & 1 deletion unifi-low-snr-reconnect
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ parser = argparse.ArgumentParser()
parser.add_argument('-c', '--controller', default='unifi', help='the controller address (default "unifi")')
parser.add_argument('-u', '--username', default='admin', help='the controller usernane (default "admin")')
parser.add_argument('-p', '--password', default='', help='the controller password')
parser.add_argument('-v', '--version', default='v2', help='the controller base version (default "v2")')
parser.add_argument('-s', '--siteid', default='default', help='the site ID, UniFi >=3.x only (default "default")')
parser.add_argument('-m', '--minsnr', default=15, type=int, help='(dB) minimum required client SNR (default 15)')
parser.add_argument('-i', '--checkintv', default=5, type=int, help='(s) check interval (default 5)')
parser.add_argument('-o', '--holdintv', default=300, type=int, help='(s) holddown interval (default 300)')
parser.add_argument('-d', '--debug', help='enable debug output', action='store_true')
args = parser.parse_args()

c = Controller(args.controller, args.username, args.password)
c = Controller(args.controller, args.username, args.password, args.version, args.siteid)

all_aps = c.get_aps()
ap_names = dict([(ap['mac'], ap['name']) for ap in all_aps])
Expand Down
4 changes: 3 additions & 1 deletion unifi-ls-clients
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ parser = argparse.ArgumentParser()
parser.add_argument('-c', '--controller', default='unifi', help='the controller address (default "unifi")')
parser.add_argument('-u', '--username', default='admin', help='the controller usernane (default("admin")')
parser.add_argument('-p', '--password', default='', help='the controller password')
parser.add_argument('-v', '--version', default='v2', help='the controller base version (default "v2")')
parser.add_argument('-s', '--siteid', default='default', help='the site ID, UniFi >=3.x only (default "default")')
args = parser.parse_args()

c = Controller(args.controller, args.username, args.password)
c = Controller(args.controller, args.username, args.password, args.version, args.siteid)

aps = c.get_aps()
ap_names = dict([(ap['mac'], ap['name']) for ap in aps])
Expand Down

0 comments on commit 7bb08f8

Please sign in to comment.