12
12
13
13
14
14
class TapoBulb (TapoDevice , SmartBulb ):
15
+ """Representation of a TP-Link Tapo Bulb.
16
+
17
+ Documentation TBD. See :class:`~kasa.smartbulb.SmartBulb` for now.
18
+ """
19
+
15
20
@property
16
21
def is_color (self ) -> bool :
22
+ """Whether the bulb supports color changes."""
17
23
# TODO: this makes an assumption that only color bulbs report this
18
24
return "hue" in self ._info
19
25
20
26
@property
21
27
def is_dimmable (self ) -> bool :
28
+ """Whether the bulb supports brightness changes."""
22
29
# TODO: this makes an assumption that only dimmables report this
23
30
return "brightness" in self ._info
24
31
25
32
@property
26
33
def is_variable_color_temp (self ) -> bool :
34
+ """Whether the bulb supports color temperature changes."""
27
35
# TODO: this makes an assumption, that only ct bulbs report this
28
36
return bool (self ._info .get ("color_temp_range", False ))
29
37
@@ -115,6 +123,15 @@ async def set_hsv(
115
123
* ,
116
124
transition : Optional [int ] = None ,
117
125
) -> Dict :
126
+ """Set new HSV.
127
+
128
+ Note, transition is not supported and will be ignored.
129
+
130
+ :param int hue: hue in degrees
131
+ :param int saturation: saturation in percentage [0,100]
132
+ :param int value: value in percentage [0, 100]
133
+ :param int transition: transition in milliseconds.
134
+ """
118
135
if not self .is_color :
119
136
raise SmartDeviceException ("Bulb does not support color." )
120
137
@@ -131,7 +148,13 @@ async def set_hsv(
131
148
async def set_color_temp (
132
149
self , temp : int , * , brightness = None , transition : Optional [int ] = None
133
150
) -> Dict :
134
- # TODO: Decide how to handle brightness and transition
151
+ """Set the color temperature of the device in kelvin.
152
+
153
+ Note, transition is not supported and will be ignored.
154
+
155
+ :param int temp: The new color temperature, in Kelvin
156
+ :param int transition: transition in milliseconds.
157
+ """
135
158
# TODO: Note, trying to set brightness at the same time
136
159
# with color_temp causes error -1008
137
160
if not self .is_variable_color_temp :
@@ -142,7 +165,13 @@ async def set_color_temp(
142
165
async def set_brightness (
143
166
self , brightness : int , * , transition : Optional [int ] = None
144
167
) -> Dict :
145
- # TODO: Decide how to handle transitions
168
+ """Set the brightness in percentage.
169
+
170
+ Note, transition is not supported and will be ignored.
171
+
172
+ :param int brightness: brightness in percent
173
+ :param int transition: transition in milliseconds.
174
+ """
146
175
if not self .is_dimmable : # pragma: no cover
147
176
raise SmartDeviceException ("Bulb is not dimmable." )
148
177
@@ -186,4 +215,5 @@ async def set_effect(
186
215
187
216
@property
188
217
def presets (self ) -> List [SmartBulbPreset ]:
189
- return []
218
+ """Return a list of available bulb setting presets."""
219
+ raise NotImplementedError ()
0 commit comments