Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/test_device_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ async def test_power_on_uses_lighting_service(self):
with patch.object(device, '_pass_through_request', new_callable=AsyncMock) as mock:
await device.power_on()
mock.assert_called_once_with(
'smartlife.iot.smartbulb.lightingservice',
'transition_light_state',
'smartlife.iot.lightStrip',
'set_light_state',
{'on_off': 1}
)

Expand All @@ -143,8 +143,8 @@ async def test_set_color(self):
with patch.object(device, '_pass_through_request', new_callable=AsyncMock) as mock:
await device.set_color(hue=240, saturation=100, brightness=75)
mock.assert_called_once_with(
'smartlife.iot.smartbulb.lightingservice',
'transition_light_state',
'smartlife.iot.lightStrip',
'set_light_state',
{'on_off': 1, 'hue': 240, 'saturation': 100,
'color_temp': 0, 'brightness': 75}
)
Expand All @@ -157,8 +157,8 @@ async def test_set_color_temp(self):
with patch.object(device, '_pass_through_request', new_callable=AsyncMock) as mock:
await device.set_color_temp(color_temp=4000)
mock.assert_called_once_with(
'smartlife.iot.smartbulb.lightingservice',
'transition_light_state',
'smartlife.iot.lightStrip',
'set_light_state',
{'on_off': 1, 'color_temp': 4000}
)

Expand Down Expand Up @@ -188,8 +188,8 @@ async def test_set_brightness(self):
with patch.object(device, '_pass_through_request', new_callable=AsyncMock) as mock:
await device.set_brightness(50)
mock.assert_called_once_with(
'smartlife.iot.smartbulb.lightingservice',
'transition_light_state',
'smartlife.iot.lightStrip',
'set_light_state',
{'on_off': 1, 'brightness': 50}
)

Expand Down
8 changes: 6 additions & 2 deletions tplinkcloud/kl420l5.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from .device_type import TPLinkDeviceType
from .device import TPLinkDevice

_LIGHTING_SERVICE = 'smartlife.iot.smartbulb.lightingservice'
# The KL42x/KL43x light strips do not support the smartbulb lighting
# service (err_code -2001 'module not support'); they use the
# lightStrip module with set_light_state. Verified against a live
# KL420L5(US).
_LIGHTING_SERVICE = 'smartlife.iot.lightStrip'


class KL420L5LightState:
Expand Down Expand Up @@ -79,7 +83,7 @@ async def set_light_state(self, on_off=None, brightness=None, hue=None,
if transition_period is not None:
state['transition_period'] = transition_period
return await self._pass_through_request(
_LIGHTING_SERVICE, 'transition_light_state', state)
_LIGHTING_SERVICE, 'set_light_state', state)

async def power_on(self):
return await self.set_light_state(on_off=1)
Expand Down
8 changes: 6 additions & 2 deletions tplinkcloud/kl430.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from .device_type import TPLinkDeviceType
from .device import TPLinkDevice

_LIGHTING_SERVICE = 'smartlife.iot.smartbulb.lightingservice'
# The KL42x/KL43x light strips do not support the smartbulb lighting
# service (err_code -2001 'module not support'); they use the
# lightStrip module with set_light_state. Verified against a live
# KL420L5(US).
_LIGHTING_SERVICE = 'smartlife.iot.lightStrip'


class KL430LightState:
Expand Down Expand Up @@ -79,7 +83,7 @@ async def set_light_state(self, on_off=None, brightness=None, hue=None,
if transition_period is not None:
state['transition_period'] = transition_period
return await self._pass_through_request(
_LIGHTING_SERVICE, 'transition_light_state', state)
_LIGHTING_SERVICE, 'set_light_state', state)

async def power_on(self):
return await self.set_light_state(on_off=1)
Expand Down
Loading