mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Migrate TurnOnBehaviours to mashumaro (#1285)
This commit is contained in:
@@ -176,6 +176,23 @@ MOTION_MODULE = {
|
||||
}
|
||||
}
|
||||
|
||||
LIGHT_DETAILS = {
|
||||
"color_rendering_index": 80,
|
||||
"err_code": 0,
|
||||
"incandescent_equivalent": 60,
|
||||
"lamp_beam_angle": 150,
|
||||
"max_lumens": 800,
|
||||
"max_voltage": 120,
|
||||
"min_voltage": 110,
|
||||
"wattage": 10,
|
||||
}
|
||||
|
||||
DEFAULT_BEHAVIOR = {
|
||||
"err_code": 0,
|
||||
"hard_on": {"mode": "circadian"},
|
||||
"soft_on": {"mode": "last_status"},
|
||||
}
|
||||
|
||||
|
||||
class FakeIotProtocol(IotProtocol):
|
||||
def __init__(self, info, fixture_name=None, *, verbatim=False):
|
||||
@@ -399,6 +416,8 @@ class FakeIotTransport(BaseTransport):
|
||||
},
|
||||
"smartlife.iot.smartbulb.lightingservice": {
|
||||
"get_light_state": light_state,
|
||||
"get_light_details": LIGHT_DETAILS,
|
||||
"get_default_behavior": DEFAULT_BEHAVIOR,
|
||||
"transition_light_state": transition_light_state,
|
||||
"set_preferred_state": set_preferred_state,
|
||||
},
|
||||
@@ -409,6 +428,8 @@ class FakeIotTransport(BaseTransport):
|
||||
"smartlife.iot.lightStrip": {
|
||||
"set_light_state": transition_light_state,
|
||||
"get_light_state": light_state,
|
||||
"get_light_details": LIGHT_DETAILS,
|
||||
"get_default_behavior": DEFAULT_BEHAVIOR,
|
||||
"set_preferred_state": set_preferred_state,
|
||||
},
|
||||
"smartlife.iot.common.system": {
|
||||
|
@@ -497,3 +497,9 @@ SYSINFO_SCHEMA_BULB = SYSINFO_SCHEMA.extend(
|
||||
@bulb
|
||||
def test_device_type_bulb(dev: Device):
|
||||
assert dev.device_type in {DeviceType.Bulb, DeviceType.LightStrip}
|
||||
|
||||
|
||||
@bulb_iot
|
||||
async def test_turn_on_behaviours(dev: IotBulb):
|
||||
behavior = await dev.get_turn_on_behavior()
|
||||
assert behavior
|
||||
|
Reference in New Issue
Block a user