"""Xiaomi Zigbee lights."""
import click
from miio.click_common import command
from .subdevice import SubDevice
[docs]
class LightBulb(SubDevice):
"""Base class for subdevice light bulbs."""
[docs]
@command()
def on(self):
"""Turn bulb on."""
return self.send_arg("set_power", ["on"]).pop()
[docs]
@command()
def off(self):
"""Turn bulb off."""
return self.send_arg("set_power", ["off"]).pop()
[docs]
@command(click.argument("ctt", type=int))
def set_color_temp(self, ctt):
"""Set the color temperature of the bulb ctt_min-ctt_max."""
return self.send_arg("set_ct", [ctt]).pop()
[docs]
@command(click.argument("brightness", type=int))
def set_brightness(self, brightness):
"""Set the brightness of the bulb 1-100."""
return self.send_arg("set_bright", [brightness]).pop()