diff --git a/miio/philips_eyecare.py b/miio/philips_eyecare.py index f2544b72f..a6ed52141 100644 --- a/miio/philips_eyecare.py +++ b/miio/philips_eyecare.py @@ -1,6 +1,6 @@ import logging from collections import defaultdict -from typing import Any, Dict +from typing import Any, Dict, Optional import click @@ -60,9 +60,11 @@ def eyecare(self) -> bool: return self.data["eyecare"] == "on" @property - def scene(self) -> int: + def scene(self) -> Optional[int]: """Current fixed scene.""" - return self.data["scene_num"] + if "scene_num" in self.data and self.data["scene_num"] is not None: + return self.data["scene_num"] + return None @property def smart_night_light(self) -> bool: @@ -97,13 +99,12 @@ def status(self) -> PhilipsEyecareStatus: properties = [ "power", "bright", - "notifystatus", "ambstatus", + "notifystatus", "ambvalue", + "dvalue", "eyecare", - "scene_num", "bls", - "dvalue", ] values = self.get_properties(properties) diff --git a/miio/tests/test_philips_eyecare.py b/miio/tests/test_philips_eyecare.py index 9b829e0ee..45aca7ec1 100644 --- a/miio/tests/test_philips_eyecare.py +++ b/miio/tests/test_philips_eyecare.py @@ -17,7 +17,6 @@ def __init__(self, *args, **kwargs): "ambstatus": "off", "ambvalue": 100, "eyecare": "on", - "scene_num": 3, "bls": "on", "dvalue": 0, } @@ -77,7 +76,6 @@ def test_status(self): assert self.state().ambient is (self.device.start_state["ambstatus"] == "on") assert self.state().ambient_brightness == self.device.start_state["ambvalue"] assert self.state().eyecare is (self.device.start_state["eyecare"] == "on") - assert self.state().scene == self.device.start_state["scene_num"] assert self.state().smart_night_light is ( self.device.start_state["bls"] == "on" ) @@ -112,13 +110,8 @@ def brightness(): self.device.set_brightness(101) def test_set_scene(self): - def scene(): - return self.device.status().scene - self.device.set_scene(1) - assert scene() == 1 self.device.set_scene(2) - assert scene() == 2 with pytest.raises(PhilipsEyecareException): self.device.set_scene(-1)