mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Fix for P100 on fw 1.1.3 login_version none (#751)
* Fix for P100 on fw 1.1.3 login_version none * Fix coverage * Add delay before trying default login * Move devtools and fixture out * Change logging string Co-authored-by: Teemu R. <tpr@iki.fi> * Fix test --------- Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
@@ -69,7 +69,7 @@ class SmartDevice(Device):
|
||||
resp = await self.protocol.query("component_nego")
|
||||
self._components_raw = resp["component_nego"]
|
||||
self._components = {
|
||||
comp["id"]: comp["ver_code"]
|
||||
comp["id"]: int(comp["ver_code"])
|
||||
for comp in self._components_raw["component_list"]
|
||||
}
|
||||
await self._initialize_modules()
|
||||
@@ -86,9 +86,14 @@ class SmartDevice(Device):
|
||||
"get_current_power": None,
|
||||
}
|
||||
|
||||
if self._components["device"] >= 2:
|
||||
extra_reqs = {
|
||||
**extra_reqs,
|
||||
"get_device_usage": None,
|
||||
}
|
||||
|
||||
req = {
|
||||
"get_device_info": None,
|
||||
"get_device_usage": None,
|
||||
"get_device_time": None,
|
||||
**extra_reqs,
|
||||
}
|
||||
@@ -96,8 +101,9 @@ class SmartDevice(Device):
|
||||
resp = await self.protocol.query(req)
|
||||
|
||||
self._info = resp["get_device_info"]
|
||||
self._usage = resp["get_device_usage"]
|
||||
self._time = resp["get_device_time"]
|
||||
# Device usage is not available on older firmware versions
|
||||
self._usage = resp.get("get_device_usage", {})
|
||||
# Emeter is not always available, but we set them still for now.
|
||||
self._energy = resp.get("get_energy_usage", {})
|
||||
self._emeter = resp.get("get_current_power", {})
|
||||
|
Reference in New Issue
Block a user