Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reboot command to CLI #26

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 1 addition & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pydantic = "^2.7.4"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
setuptools = "^69.0.2"
pytest-ruff = "^0.3.2"
ruff = "^0.4.8"
pytest-asyncio = "^0.23.8"
Expand Down
Loading