Refactor devices into subpackages and deprecate old names (#716)

* Refactor devices into subpackages and deprecate old names

* Tweak and add tests

* Fix linting

* Remove duplicate implementations affecting project coverage

* Update post review

* Add device base class attributes and rename subclasses

* Rename Module to BaseModule

* Remove has_emeter_history

* Fix missing _time in init

* Update post review

* Fix test_readmeexamples

* Fix erroneously duped files

* Clean up iot and smart imports

* Update post latest review

* Tweak Device docstring
This commit is contained in:
Steven B
2024-02-04 15:20:08 +00:00
committed by GitHub
parent 6afd05be59
commit 0d119e63d0
49 changed files with 1046 additions and 606 deletions

View File

@@ -2,7 +2,8 @@ from datetime import datetime
import pytest
from kasa import SmartDeviceException, SmartStrip
from kasa import SmartDeviceException
from kasa.iot import IotStrip
from .conftest import handle_turn_on, strip, turn_on
@@ -68,7 +69,7 @@ async def test_children_on_since(dev):
@strip
async def test_get_plug_by_name(dev: SmartStrip):
async def test_get_plug_by_name(dev: IotStrip):
name = dev.children[0].alias
assert dev.get_plug_by_name(name) == dev.children[0] # type: ignore[arg-type]
@@ -77,7 +78,7 @@ async def test_get_plug_by_name(dev: SmartStrip):
@strip
async def test_get_plug_by_index(dev: SmartStrip):
async def test_get_plug_by_index(dev: IotStrip):
assert dev.get_plug_by_index(0) == dev.children[0]
with pytest.raises(SmartDeviceException):