mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Add colortemp feature for iot devices (#827)
Make color temperature feature available for iot bulbs.
This commit is contained in:
parent
35dbda7049
commit
c08b58cd8b
@ -221,6 +221,19 @@ class IotBulb(IotDevice, Bulb):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.is_variable_color_temp:
|
||||||
|
self._add_feature(
|
||||||
|
Feature(
|
||||||
|
device=self,
|
||||||
|
name="Color temperature",
|
||||||
|
container=self,
|
||||||
|
attribute_getter="color_temp",
|
||||||
|
attribute_setter="set_color_temp",
|
||||||
|
range_getter="valid_temperature_range",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@property # type: ignore
|
@property # type: ignore
|
||||||
@requires_update
|
@requires_update
|
||||||
def is_color(self) -> bool:
|
def is_color(self) -> bool:
|
||||||
|
@ -133,11 +133,6 @@ async def test_variable_temp_state_information(dev: Bulb):
|
|||||||
assert "Color temperature" in dev.state_information
|
assert "Color temperature" in dev.state_information
|
||||||
assert dev.state_information["Color temperature"] == dev.color_temp
|
assert dev.state_information["Color temperature"] == dev.color_temp
|
||||||
|
|
||||||
assert "Valid temperature range" in dev.state_information
|
|
||||||
assert (
|
|
||||||
dev.state_information["Valid temperature range"] == dev.valid_temperature_range
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@variable_temp
|
@variable_temp
|
||||||
@turn_on
|
@turn_on
|
||||||
|
Loading…
Reference in New Issue
Block a user