mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-01 13:11:55 +00:00
Rename current_consumption to power
- Note: This is a breaking change. - Fix: Rename `current_consumption` to `power` in energy modules, to deconflict and clarify. - Fix: Report `0` instead of `None` for current when current is zero. - Fix: Report `0` instead of `None` for voltage when voltage is zero (not that this was possible to see).
This commit is contained in:
@@ -195,10 +195,10 @@ class StripEmeter(IotModule, Energy):
|
||||
return {}
|
||||
|
||||
@property
|
||||
def current_consumption(self) -> float | None:
|
||||
def power(self) -> float | None:
|
||||
"""Get the current power consumption in watts."""
|
||||
return sum(
|
||||
v if (v := plug.modules[Module.Energy].current_consumption) else 0.0
|
||||
v if (v := plug.modules[Module.Energy].power) else 0.0
|
||||
for plug in self._device.children
|
||||
)
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ class Emeter(Usage, EnergyInterface):
|
||||
return data.get(current_month, 0.0)
|
||||
|
||||
@property
|
||||
def current_consumption(self) -> float | None:
|
||||
"""Get the current power consumption in Watt."""
|
||||
def power(self) -> float | None:
|
||||
"""Get the current power draw in Watts."""
|
||||
return self.status.power
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user