mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-24 16:28:02 +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:
@@ -133,9 +133,9 @@ async def test_erase_emeter_stats(dev):
|
||||
|
||||
|
||||
@has_emeter_iot
|
||||
async def test_current_consumption(dev):
|
||||
async def test_power(dev):
|
||||
emeter = dev.modules[Module.Energy]
|
||||
x = emeter.current_consumption
|
||||
x = emeter.power
|
||||
assert isinstance(x, float)
|
||||
assert x >= 0.0
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ async def test_update_module_query_errors(
|
||||
if mod.name == "Energy":
|
||||
emod = cast(Energy, mod)
|
||||
with pytest.raises(KasaException, match="Module update error"):
|
||||
assert emod.current_consumption is not None
|
||||
assert emod.power is not None
|
||||
else:
|
||||
assert mod.disabled is False
|
||||
assert mod._error_count == 0
|
||||
@@ -360,7 +360,7 @@ async def test_update_module_query_errors(
|
||||
# Test one of the raise_if_update_error doesn't raise
|
||||
if mod.name == "Energy":
|
||||
emod = cast(Energy, mod)
|
||||
assert emod.current_consumption is not None
|
||||
assert emod.power is not None
|
||||
|
||||
|
||||
async def test_get_modules():
|
||||
|
||||
@@ -159,4 +159,4 @@ async def test_children_energy(dev: Device):
|
||||
energy = plug.modules[Module.Energy]
|
||||
assert "voltage" in energy._module_features
|
||||
assert "current" in energy._module_features
|
||||
assert "current_consumption" in energy._module_features
|
||||
assert "power" in energy._module_features
|
||||
|
||||
Reference in New Issue
Block a user