Skip to content
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
4 changes: 2 additions & 2 deletions devtools/dump_devinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ async def get_legacy_fixture(device):
try:
click.echo(f"Testing {test_call}..", nl=False)
info = await device.protocol.query(
{test_call.module: {test_call.method: None}}
{test_call.module: {test_call.method: {}}}
)
resp = info[test_call.module]
except Exception as ex:
Expand All @@ -302,7 +302,7 @@ async def get_legacy_fixture(device):
final_query = defaultdict(defaultdict)
final = defaultdict(defaultdict)
for succ, resp in successes:
final_query[succ.module][succ.method] = None
final_query[succ.module][succ.method] = {}
final[succ.module][succ.method] = resp

final = default_to_regular(final)
Expand Down
4 changes: 2 additions & 2 deletions kasa/device_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

_LOGGER = logging.getLogger(__name__)

GET_SYSINFO_QUERY = {
"system": {"get_sysinfo": None},
GET_SYSINFO_QUERY: dict[str, dict[str, dict]] = {
"system": {"get_sysinfo": {}},
}


Expand Down
4 changes: 2 additions & 2 deletions kasa/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ class Discover:

DISCOVERY_PORT = 9999

DISCOVERY_QUERY = {
"system": {"get_sysinfo": None},
DISCOVERY_QUERY: dict[str, dict[str, dict]] = {
"system": {"get_sysinfo": {}},
}

DISCOVERY_PORT_2 = 20002
Expand Down
2 changes: 2 additions & 0 deletions kasa/iot/iotdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def add_module(self, name: str | ModuleName[Module], module: IotModule):
def _create_request(
self, target: str, cmd: str, arg: dict | None = None, child_ids=None
):
if arg is None:
arg = {}
request: dict[str, Any] = {target: {cmd: arg}}
if child_ids is not None:
request = {"context": {"child_ids": child_ids}, target: {cmd: arg}}
Expand Down
1 change: 0 additions & 1 deletion kasa/klaptransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class KlapTransport(BaseTransport):
"""

DEFAULT_PORT: int = 80
DISCOVERY_QUERY = {"system": {"get_sysinfo": None}}
SESSION_COOKIE_NAME = "TP_SESSIONID"
TIMEOUT_COOKIE_NAME = "TIMEOUT"

Expand Down