mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add voltage and current monitoring to smart Devices (#1281)
This commit is contained in:
@@ -138,6 +138,19 @@ class FakeSmartTransport(BaseTransport):
|
||||
),
|
||||
"get_device_usage": ("device", {}),
|
||||
"get_connect_cloud_state": ("cloud_connect", {"status": 0}),
|
||||
"get_emeter_data": (
|
||||
"energy_monitoring",
|
||||
{
|
||||
"current_ma": 33,
|
||||
"energy_wh": 971,
|
||||
"power_mw": 1003,
|
||||
"voltage_mv": 121215,
|
||||
},
|
||||
),
|
||||
"get_emeter_vgain_igain": (
|
||||
"energy_monitoring",
|
||||
{"igain": 10861, "vgain": 118657},
|
||||
),
|
||||
}
|
||||
|
||||
async def send(self, request: str):
|
||||
|
@@ -211,5 +211,8 @@ async def test_supported(dev: Device):
|
||||
assert energy_module.supports(Energy.ModuleFeature.PERIODIC_STATS) is True
|
||||
else:
|
||||
assert energy_module.supports(Energy.ModuleFeature.CONSUMPTION_TOTAL) is False
|
||||
assert energy_module.supports(Energy.ModuleFeature.VOLTAGE_CURRENT) is False
|
||||
assert energy_module.supports(Energy.ModuleFeature.PERIODIC_STATS) is False
|
||||
if energy_module.supported_version < 2:
|
||||
assert energy_module.supports(Energy.ModuleFeature.VOLTAGE_CURRENT) is False
|
||||
else:
|
||||
assert energy_module.supports(Energy.ModuleFeature.VOLTAGE_CURRENT) is True
|
||||
|
Reference in New Issue
Block a user