Pull up emeter handling to tapodevice base class (#601)

* Pull has_emeter property up to tapodevice base class

This will also use the existence of energy_monitoring in the component_nego query to decide if the device has the service.

* Move emeter related functions to tapodevice

* Remove supported_modules override for now

This should be done in a separate PR, if we want to expose the available components to cli and downstreams

* Dedent extra reqs

* Move extra_reqs initialization

* Fix tests
This commit is contained in:
Teemu R
2024-01-03 19:04:34 +01:00
committed by GitHub
parent 864ea92ece
commit 10fc2c3c54
4 changed files with 76 additions and 79 deletions

View File

@@ -7,7 +7,7 @@ import pytest # type: ignore # https://github.com/pytest-dev/pytest/issues/3342
import kasa
from kasa import Credentials, DeviceConfig, SmartDevice, SmartDeviceException
from .conftest import device_iot, handle_turn_on, has_emeter, no_emeter_iot, turn_on
from .conftest import device_iot, handle_turn_on, has_emeter_iot, no_emeter_iot, turn_on
from .newfakes import PLUG_SCHEMA, TZ_SCHEMA, FakeTransportProtocol
# List of all SmartXXX classes including the SmartDevice base class
@@ -35,7 +35,7 @@ async def test_invalid_connection(dev):
await dev.update()
@has_emeter
@has_emeter_iot
async def test_initial_update_emeter(dev, mocker):
"""Test that the initial update performs second query if emeter is available."""
dev._last_update = None