Skip to content

Commit

Permalink
gateway: fix zigbee lights (rytilahti#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG authored and xvlady committed May 9, 2021
1 parent 8e636a6 commit 968c84d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 34 deletions.
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

0 comments on commit 968c84d

Please sign in to comment.