mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Fix energy module calling get_current_power (#798)
This commit is contained in:
parent
24344b71f5
commit
0306e05fb9
@ -43,12 +43,12 @@ class EnergyModule(SmartModule):
|
||||
|
||||
def query(self) -> Dict:
|
||||
"""Query to execute during the update cycle."""
|
||||
return {
|
||||
req = {
|
||||
"get_energy_usage": None,
|
||||
# The current_power in get_energy_usage is more precise (mw vs. w),
|
||||
# making this rather useless, but maybe there are version differences?
|
||||
"get_current_power": None,
|
||||
}
|
||||
if self.supported_version > 1:
|
||||
req["get_current_power"] = None
|
||||
return req
|
||||
|
||||
@property
|
||||
def current_power(self):
|
||||
@ -58,7 +58,9 @@ class EnergyModule(SmartModule):
|
||||
@property
|
||||
def energy(self):
|
||||
"""Return get_energy_usage results."""
|
||||
return self.data["get_energy_usage"]
|
||||
if en := self.data.get("get_energy_usage"):
|
||||
return en
|
||||
return self.data
|
||||
|
||||
@property
|
||||
def emeter_realtime(self):
|
||||
|
Loading…
Reference in New Issue
Block a user