Skip to content

Commit

Permalink
add reboot support
Browse files Browse the repository at this point in the history
  • Loading branch information
jschlyter committed Aug 4, 2024
1 parent 30ec5b1 commit 63f00b1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions chargeamps/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 63f00b1

Please sign in to comment.