From c1f860edcf577a2aa251b5a7fa1f3dbb54d685d4 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Wed, 6 Apr 2022 02:17:25 +0200 Subject: [PATCH] Avoid discovery on --help --- kasa/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kasa/cli.py b/kasa/cli.py index c9cab4b50..5c1e18f64 100755 --- a/kasa/cli.py +++ b/kasa/cli.py @@ -1,6 +1,7 @@ """python-kasa cli tool.""" import asyncio import logging +import sys from pprint import pformat as pf from typing import cast @@ -66,6 +67,12 @@ @click.pass_context async def cli(ctx, host, alias, target, debug, bulb, plug, lightstrip, strip, type): """A tool for controlling TP-Link smart home devices.""" # noqa + # no need to perform any checks if we are just displaying the help + if sys.argv[-1] == "--help": + # Context object is required to avoid crashing on sub-groups + ctx.obj = SmartDevice(None) + return + if debug: logging.basicConfig(level=logging.DEBUG) else: