8000 Latest review comments · python-kasa/python-kasa@43f5b8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 43f5b8e

Browse files
committed
Latest review comments
1 parent 1008bf9 commit 43f5b8e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

kasa/aesprotocol.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ class TPLinkAes(TPLinkProtocol):
5151

5252
DEFAULT_PORT = 80
5353
DEFAULT_TIMEOUT = 5
54-
DISCOVERY_QUERY = {"system": {"get_sysinfo": None}}
55-
KASA_SETUP_EMAIL = "kasa@tp-link.net"
56-
KASA_SETUP_PASSWORD = "kasaSetup" # noqa: S105
5754
SESSION_COOKIE_NAME = "TP_SESSIONID"
5855
COMMON_HEADERS = {
5956
"Content-Type": "application/json",
@@ -304,6 +301,12 @@ async def _query(self, request: Union[str, Dict], retry_count: int = 3) -> Dict:
304301
raise SmartDeviceException("Query reached somehow to unreachable")
305302

306303
async def _execute_query(self, request: Union[str, Dict], retry_count: int) -> Dict:
304+
_LOGGER.debug(
305+
"%s >> %s",
306+
self.host,
307+
_LOGGER.isEnabledFor(logging.DEBUG) and pf(request),
308+
)
309+
307310
if not self.http_client:
308311
self.http_client = httpx.AsyncClient()
309312

kasa/tapo/tapodevice.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Any, Dict, Optional, Set, cast
66

77
from ..aesprotocol import TPLinkAes
8+
from ..credentials import Credentials
89
from ..exceptions import AuthenticationException
910
from ..smartdevice import SmartDevice
1011

@@ -19,11 +20,10 @@ def __init__(
1920
host: str,
2021
*,
2122
port: Optional[int] = None,
22-
credentials,
23+
credentials: Optional[Credentials] = None,
2324
timeout: Optional[int] = None,
2425
) -> None:
2526
super().__init__(host, port=port, credentials=credentials, timeout=timeout)
26-
self._tapo_client = None
2727
self._state_information: Dict[str, Any] = {}
2828
self._discovery_info: Optional[Dict[str, Any]] = None
2929
self.protocol = TPLinkAes(host, credentials=credentials, timeout=timeout)
@@ -133,8 +133,6 @@ def state_information(self) -> Dict[str, Any]:
133133
return {
134134
"overheated": self._info.get("overheated"),
135135
"signal_level": self._info.get("signal_level"),
136-
"auto_off_status": self._info.get("auto_off_status"),
137-
"auto_off_remain_time": self._info.get("auto_off_remain_time"),
138136
"SSID": base64.b64decode(str(self._info.get("ssid"))).decode(),
139137
}
140138

kasa/tapo/tapoplug.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import datetime, timedelta
44
from typing import Any, Dict, Optional, cast
55

6+
from ..credentials import Credentials
67
from ..emeterstatus import EmeterStatus
78
from ..smartdevice import DeviceType
89
from .tapodevice import TapoDevice
@@ -18,7 +19,7 @@ def __init__(
1819
host: str,
1920
*,
2021
port: Optional[int] = None,
21-
credentials,
22+
credentials: Optional[Credentials] = None,
2223
timeout: Optional[int] = None,
2324
) -> None:
2425
super().__init__(host, port=port, credentials=credentials, timeout=timeout)

0 commit comments

Comments
 (0)
0