Remove SmartPlug in favor of SmartDevice (#781)

With the move towards autodetecting available features, there is no reason to keep SmartPlug around.

kasa.smart.SmartPlug is removed in favor of kasa.smart.SmartDevice which offers the same functionality.
Information about auto_off can be accessed using Features of the AutoOffModule on supported devices.

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
This commit is contained in:
Teemu R
2024-02-22 14:34:55 +01:00
committed by GitHub
parent 8c39e81a40
commit d9d2f1a430
10 changed files with 70 additions and 61 deletions

View File

@@ -22,16 +22,21 @@ from voluptuous import (
import kasa
from kasa import Credentials, Device, DeviceConfig, KasaException
from kasa.device_type import DeviceType
from kasa.exceptions import SmartErrorCode
from kasa.iot import IotDevice
from kasa.smart import SmartChildDevice, SmartDevice
from .conftest import (
bulb,
device_iot,
device_smart,
dimmer,
handle_turn_on,
has_emeter_iot,
lightstrip,
no_emeter_iot,
plug,
turn_on,
)
from .fakeprotocol_iot import FakeIotProtocol
@@ -416,3 +421,25 @@ SYSINFO_SCHEMA = Schema(
},
extra=REMOVE_EXTRA,
)
@dimmer
def test_device_type_dimmer(dev):
assert dev.device_type == DeviceType.Dimmer
@bulb
def test_device_type_bulb(dev):
if dev.is_light_strip:
pytest.skip("bulb has also lightstrips to test the api")
assert dev.device_type == DeviceType.Bulb
@plug
def test_device_type_plug(dev):
assert dev.device_type == DeviceType.Plug
@lightstrip
def test_device_type_lightstrip(dev):
assert dev.device_type == DeviceType.LightStrip