diff --git a/miio/gateway/devices/light.py b/miio/gateway/devices/light.py index fa367e761..3604470e6 100644 --- a/miio/gateway/devices/light.py +++ b/miio/gateway/devices/light.py @@ -9,16 +9,6 @@ class LightBulb(SubDevice): """Base class for subdevice light bulbs.""" - @command() - def update(self): - """Update all device properties.""" - self._props["brightness"] = self.send("get_bright").pop() - self._props["color_temp"] = self.send("get_ct").pop() - if self._props["brightness"] > 0 and self._props["brightness"] <= 100: - self._props["status"] = "on" - else: - self._props["status"] = "off" - @command() def on(self): """Turn bulb on.""" diff --git a/miio/gateway/devices/subdevices.yaml b/miio/gateway/devices/subdevices.yaml index 96fcc5bbc..fea5145ae 100644 --- a/miio/gateway/devices/subdevices.yaml +++ b/miio/gateway/devices/subdevices.yaml @@ -128,11 +128,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -147,11 +153,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -166,11 +178,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -185,11 +203,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -204,11 +228,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -223,11 +253,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -242,11 +278,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153 @@ -261,11 +303,17 @@ type: LightBulb class: LightBulb properties: - - property: status # 'on' / 'off' - - property: brightness + - property: power_status # 'on' / 'off' + name: status + get: get_property_exp + - property: light_level + name: brightness unit: percent - - property: color_temp + get: get_property_exp + - property: colour_temperature + name: color_temp unit: cct + get: get_property_exp - property: cct_min unit: cct default: 153