Skip to content

Commit

Permalink
Add KL130 fixture, initial lightstrip tests (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti committed Sep 24, 2021
1 parent acb221b commit f1b28e7
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
85 changes: 85 additions & 0 deletions kasa/tests/fixtures/KL130(EU)_1.0_1.8.8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"smartlife.iot.common.emeter": {
"get_realtime": {
"err_code": 0,
"power_mw": 1300
}
},
"smartlife.iot.smartbulb.lightingservice": {
"get_light_state": {
"brightness": 5,
"color_temp": 2700,
"err_code": 0,
"hue": 1,
"mode": "normal",
"on_off": 1,
"saturation": 1
}
},
"system": {
"get_sysinfo": {
"active_mode": "schedule",
"alias": "bedroom",
"ctrl_protocols": {
"name": "Linkie",
"version": "1.0"
},
"description": "Smart Wi-Fi LED Bulb with Color Changing",
"dev_state": "normal",
"deviceId": "0000000000000000000000000000000000000000",
"disco_ver": "1.0",
"err_code": 0,
"heapsize": 332316,
"hwId": "00000000000000000000000000000000",
"hw_ver": "1.0",
"is_color": 1,
"is_dimmable": 1,
"is_factory": false,
"is_variable_color_temp": 1,
"light_state": {
"brightness": 5,
"color_temp": 2700,
"hue": 1,
"mode": "normal",
"on_off": 1,
"saturation": 1
},
"mic_mac": "000000000000",
"mic_type": "IOT.SMARTBULB",
"model": "KL130(EU)",
"oemId": "00000000000000000000000000000000",
"preferred_state": [
{
"brightness": 10,
"color_temp": 2500,
"hue": 0,
"index": 0,
"saturation": 0
},
{
"brightness": 100,
"color_temp": 0,
"hue": 299,
"index": 1,
"saturation": 95
},
{
"brightness": 100,
"color_temp": 0,
"hue": 120,
"index": 2,
"saturation": 75
},
{
"brightness": 100,
"color_temp": 0,
"hue": 240,
"index": 3,
"saturation": 75
}
],
"rssi": -62,
"sw_ver": "1.8.8 Build 190613 Rel.123436"
}
}
}
17 changes: 17 additions & 0 deletions kasa/tests/test_lightstrip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from kasa import DeviceType, SmartLightStrip

from .conftest import lightstrip, pytestmark


@lightstrip
async def test_lightstrip_length(dev: SmartLightStrip):
assert dev.is_light_strip
assert dev.device_type == DeviceType.LightStrip
assert dev.length == dev.sys_info["length"]


@lightstrip
async def test_lightstrip_effect(dev: SmartLightStrip):
assert isinstance(dev.effect, dict)
for k in ["brightness", "custom", "enable", "id", "name"]:
assert k in dev.effect

0 comments on commit f1b28e7

Please sign in to comment.