-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from reey/master
add support for reconnecting wireless clients
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Implementation for 'client' command""" | ||
|
||
from argparse import _SubParsersAction | ||
from .config import get_target_config, to_omada_connection | ||
from .util import get_client_mac, get_target_argument | ||
|
||
|
||
async def command_reconnect_client(args) -> int: | ||
"""Executes 'reconnect-client' command""" | ||
controller = get_target_argument(args) | ||
config = get_target_config(controller) | ||
|
||
async with to_omada_connection(config) as client: | ||
site_client = await client.get_site_client(config.site) | ||
mac = await get_client_mac(site_client, args["mac"]) | ||
await site_client.reconnect_client(mac) | ||
return 0 | ||
|
||
|
||
def arg_parser(subparsers: _SubParsersAction) -> None: | ||
"""Configures arguments parser for 'reconnect-client' command""" | ||
reconnect_parser = subparsers.add_parser("reconnect-client", help="Reconnects a client") | ||
|
||
reconnect_parser.add_argument( | ||
"mac", | ||
help="The MAC address or name of the client", | ||
) | ||
|
||
reconnect_parser.set_defaults(func=command_reconnect_client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters