Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions miio/gateway/devices/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
96 changes: 72 additions & 24 deletions miio/gateway/devices/subdevices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down