Create common interfaces for remaining device types (#895)

Introduce common module interfaces across smart and iot devices and provide better typing implementation for getting modules to support this.
This commit is contained in:
Steven B
2024-05-10 19:29:28 +01:00
committed by GitHub
parent 7d4dc4c710
commit 9473d97ad2
33 changed files with 673 additions and 220 deletions

View File

@@ -1,7 +1,6 @@
import pytest
from kasa import SmartDevice
from kasa.smart.modules import ContactSensor
from kasa import Module, SmartDevice
from kasa.tests.device_fixtures import parametrize
contact = parametrize(
@@ -18,7 +17,7 @@ contact = parametrize(
)
async def test_contact_features(dev: SmartDevice, feature, type):
"""Test that features are registered and work as expected."""
contact = dev.get_module(ContactSensor)
contact = dev.modules.get(Module.ContactSensor)
assert contact is not None
prop = getattr(contact, feature)