Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gateway: fix zigbee lights #1016

Merged
merged 1 commit into from
Apr 12, 2021
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