From 63f00b153c092f3109eea7284613d55f3a3e630d Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Sun, 4 Aug 2024 18:21:38 +0200 Subject: [PATCH] add reboot support --- chargeamps/cli.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/chargeamps/cli.py b/chargeamps/cli.py index b6bd238..7bfda17 100644 --- a/chargeamps/cli.py +++ b/chargeamps/cli.py @@ -14,8 +14,8 @@ from isoduration import parse_duration from . import __version__ -from .base import ChargeAmpsClient, StartAuth -from .external import ChargeAmpsExternalClient +from .base import ChargeAmpsClient +from .external import ChargeAmpsExternalClient, StartAuth logger = logging.getLogger(__name__) @@ -159,6 +159,11 @@ async def command_remote_stop( await client.remote_stop(charge_point_id, connector_id) +async def command_reboot(client: ChargeAmpsClient, args: argparse.Namespace) -> None: + charge_point_id = await get_chargepoint_id(client, args) + await client.reboot(charge_point_id) + + def add_arg_chargepoint(parser, required=False): parser.add_argument( "--chargepoint", @@ -334,6 +339,10 @@ async def main_loop() -> None: add_arg_chargepoint(parser_remote_stop) add_arg_connector(parser_remote_stop) + parser_reboot = subparsers.add_parser("reboot", help="Reboot chargepoint") + parser_reboot.set_defaults(func=command_reboot) + add_arg_chargepoint(parser_reboot) + args = parser.parse_args() if args.debug: