mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add colortemp module (#814)
Allow controlling the color temperature via features interface: ``` $ kasa --host 192.168.xx.xx feature color_temperature Color temperature (color_temperature): 0 $ kasa --host 192.168.xx.xx feature color_temperature 2000 Setting color_temperature to 2000 Raised error: Temperature should be between 2500 and 6500, was 2000 Run with --debug enabled to see stacktrace $ kasa --host 192.168.xx.xx feature color_temperature 3000 Setting color_temperature to 3000 $ kasa --host 192.168.xx.xx feature color_temperature Color temperature (color_temperature): 3000 ```
This commit is contained in:
@@ -41,6 +41,17 @@ class Feature:
|
||||
minimum_value: int = 0
|
||||
#: Maximum value
|
||||
maximum_value: int = 2**16 # Arbitrary max
|
||||
#: Attribute containing the name of the range getter property.
|
||||
#: If set, this property will be used to set *minimum_value* and *maximum_value*.
|
||||
range_getter: Optional[str] = None
|
||||
|
||||
def __post_init__(self):
|
||||
"""Handle late-binding of members."""
|
||||
container = self.container if self.container is not None else self.device
|
||||
if self.range_getter is not None:
|
||||
self.minimum_value, self.maximum_value = getattr(
|
||||
container, self.range_getter
|
||||
)
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
|
Reference in New Issue
Block a user