diff --git a/iolite_client/entity.py b/iolite_client/entity.py index 6c33833..39692a1 100644 --- a/iolite_client/entity.py +++ b/iolite_client/entity.py @@ -55,11 +55,17 @@ def __init__( class Heating(Entity): def __init__( - self, identifier: str, name: str, current_temp: float, target_temp: float + self, + identifier: str, + name: str, + current_temp: float, + target_temp: float, + window_open: bool, ): super().__init__(identifier, name) self.current_temp = current_temp self.target_temp = target_temp + self.window_open = window_open class Room(Entity): @@ -73,7 +79,6 @@ def add_device(self, device: Device): raise Exception( f"Trying to add device to wrong room {device.place_identifier} != {self.identifier}" ) - self.devices[device.identifier] = device def has_device(self, device: Device) -> bool: diff --git a/iolite_client/entity_factory.py b/iolite_client/entity_factory.py index e037d0d..d927b23 100644 --- a/iolite_client/entity_factory.py +++ b/iolite_client/entity_factory.py @@ -44,6 +44,7 @@ def create_heating(payload: dict) -> Heating: payload["name"], payload["currentTemperature"], payload["targetTemperature"], + payload["windowOpen"], ) diff --git a/test/test_client.py b/test/test_client.py index f8b4eb8..0a57e1f 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -11,7 +11,9 @@ def setUp(self) -> None: self.bedroom_switch = Switch( "2", "Bedroom Switch", self.bedroom.identifier, "Generic" ) - self.bedroom_heating = Heating(self.bedroom.identifier, "Bedroom", 10, 20) + self.bedroom_heating = Heating( + self.bedroom.identifier, "Bedroom", 10, 20, False + ) self.discovered = Discovered() def test_switch_without_room_is_unmapped(self): diff --git a/test/test_entity.py b/test/test_entity.py index f3b44b6..cab7030 100644 --- a/test/test_entity.py +++ b/test/test_entity.py @@ -19,7 +19,9 @@ def setUp(self) -> None: "Normal", 0.0, ) - self.bedroom_heating = Heating(self.bedroom.identifier, "Bedroom", 20.0, 21.5) + self.bedroom_heating = Heating( + self.bedroom.identifier, "Bedroom", 20.0, 21.5, False + ) def test_empty_room(self): self.assertEqual(0, len(self.bedroom.devices)) diff --git a/test/test_oauth_handler.py b/test/test_oauth_handler.py index f8cf977..eab684c 100644 --- a/test/test_oauth_handler.py +++ b/test/test_oauth_handler.py @@ -112,7 +112,6 @@ def test_get_sid_expired_access_token(self): @freeze_time("2021-01-01 00:00:00") def test_invalid_token_refresh(self): - token = self._get_token(datetime.datetime(2021, 1, 1, 0, 0, 1)) self.mock_oauth_storage.fetch_access_token.return_value = token @@ -139,7 +138,7 @@ def _get_token(date_time: datetime.datetime) -> dict: class AsyncOAuthWrapperTest(unittest.TestCase): - def setUp(self) -> None: + async def asyncSetUp(self) -> None: self.mock_async_oauth_handler = Mock() self.mock_async_oauth_storage = Mock() self.async_oauth_wrapper = AsyncOAuthWrapper( @@ -175,7 +174,6 @@ async def test_get_sid_expired_access_token(self): @pytest.mark.asyncio @freeze_time("2021-01-01 00:00:00") async def test_invalid_token_refresh(self): - token = self._get_token(datetime.datetime(2021, 1, 1, 0, 0, 1)) self.mock_async_oauth_storage.fetch_access_token.return_value = token