2020-05-27 14:55:18 +00:00
|
|
|
from kasa import DeviceType
|
|
|
|
|
2023-12-04 18:50:05 +00:00
|
|
|
from .conftest import plug, plug_smart
|
2024-01-29 19:26:39 +00:00
|
|
|
from .test_smartdevice import SYSINFO_SCHEMA
|
|
|
|
|
|
|
|
# these schemas should go to the mainlib as
|
|
|
|
# they can be useful when adding support for new features/devices
|
|
|
|
# as well as to check that faked devices are operating properly.
|
2020-05-27 14:55:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
@plug
|
|
|
|
async def test_plug_sysinfo(dev):
|
|
|
|
assert dev.sys_info is not None
|
2024-01-29 19:26:39 +00:00
|
|
|
SYSINFO_SCHEMA(dev.sys_info)
|
2020-05-27 14:55:18 +00:00
|
|
|
|
|
|
|
assert dev.model is not None
|
|
|
|
|
|
|
|
assert dev.device_type == DeviceType.Plug or dev.device_type == DeviceType.Strip
|
|
|
|
assert dev.is_plug or dev.is_strip
|
|
|
|
|
|
|
|
|
|
|
|
@plug
|
|
|
|
async def test_led(dev):
|
|
|
|
original = dev.led
|
|
|
|
|
|
|
|
await dev.set_led(False)
|
2021-09-19 21:45:48 +00:00
|
|
|
await dev.update()
|
2020-05-27 14:55:18 +00:00
|
|
|
assert not dev.led
|
|
|
|
|
|
|
|
await dev.set_led(True)
|
2021-09-19 21:45:48 +00:00
|
|
|
await dev.update()
|
2020-05-27 14:55:18 +00:00
|
|
|
assert dev.led
|
|
|
|
|
|
|
|
await dev.set_led(original)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
@plug_smart
|
|
|
|
async def test_plug_device_info(dev):
|
|
|
|
assert dev._info is not None
|
|
|
|
# PLUG_SCHEMA(dev.sys_info)
|
|
|
|
|
|
|
|
assert dev.model is not None
|
|
|
|
|
|
|
|
assert dev.device_type == DeviceType.Plug or dev.device_type == DeviceType.Strip
|
|
|
|
# assert dev.is_plug or dev.is_strip
|