Add colortemp feature for iot devices (#827)

Make color temperature feature available for iot bulbs.
This commit is contained in:
Teemu R 2024-03-26 19:33:10 +01:00 committed by GitHub
parent 35dbda7049
commit c08b58cd8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 5 deletions

View File

@ -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:

View File

@ -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