Skip to content

Commit

Permalink
Status method moved.
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Oct 21, 2017
1 parent 02307e5 commit aff248d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions miio/philips_eyecare.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ def __str__(self) -> str:
class PhilipsEyecare(Device):
"""Main class representing Xiaomi Philips Eyecare Smart Lamp 2."""

def status(self) -> PhilipsEyecareStatus:
"""Retrieve properties."""
properties = ['power', 'bright', 'notifystatus', 'ambstatus',
'ambvalue', 'eyecare', 'scene_num', 'bls',
'dvalue', ]
values = self.send(
"get_prop",
properties
)
properties_count = len(properties)
values_count = len(values)
if properties_count != values_count:
_LOGGER.debug(
"Count (%s) of requested properties does not match the "
"count (%s) of received values.",
properties_count, values_count)

return PhilipsEyecareStatus(
defaultdict(lambda: None, zip(properties, values)))

def on(self):
"""Power on."""
return self.send("set_power", ["on"])
Expand Down Expand Up @@ -125,23 +145,3 @@ def ambient_off(self):
def set_ambient_brightness(self, level: int):
"""Set Ambient Light brightness level."""
return self.send("set_amb_bright", [level])

def status(self) -> PhilipsEyecareStatus:
"""Retrieve properties."""
properties = ['power', 'bright', 'notifystatus', 'ambstatus',
'ambvalue', 'eyecare', 'scene_num', 'bls',
'dvalue', ]
values = self.send(
"get_prop",
properties
)
properties_count = len(properties)
values_count = len(values)
if properties_count != values_count:
_LOGGER.debug(
"Count (%s) of requested properties does not match the "
"count (%s) of received values.",
properties_count, values_count)

return PhilipsEyecareStatus(
defaultdict(lambda: None, zip(properties, values)))

0 comments on commit aff248d

Please # to comment.