From 8c0ce73ead74f69ec8e5f8798eb0a32367103acb Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Thu, 31 Oct 2019 19:00:48 -0600 Subject: [PATCH] Add additional camera properties (#11) --- eufy_security/camera.py | 20 ++++++++++++++++++++ tests/test_camera.py | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/eufy_security/camera.py b/eufy_security/camera.py index 270889c..386b78f 100644 --- a/eufy_security/camera.py +++ b/eufy_security/camera.py @@ -16,11 +16,26 @@ def __init__(self, api: "API", camera_info: dict) -> None: self._api = api self.camera_info: dict = camera_info + @property + def hardware_version(self) -> str: + """Return the camera's hardware version.""" + return self.camera_info["main_hw_version"] + @property def last_camera_image_url(self) -> str: """Return the URL to the latest camera thumbnail.""" return self.camera_info["cover_path"] + @property + def mac(self) -> str: + """Return the camera MAC address.""" + return self.camera_info["wifi_mac"] + + @property + def model(self) -> str: + """Return the camera's model.""" + return self.camera_info["device_model"] + @property def name(self) -> str: """Return the camera name.""" @@ -31,6 +46,11 @@ def serial(self) -> str: """Return the camera serial number.""" return self.camera_info["device_sn"] + @property + def software_version(self) -> str: + """Return the camera's software version.""" + return self.camera_info["main_sw_version"] + @property def station_serial(self) -> str: """Return the camera's station serial number.""" diff --git a/tests/test_camera.py b/tests/test_camera.py index be2d22c..5d344bd 100644 --- a/tests/test_camera.py +++ b/tests/test_camera.py @@ -32,9 +32,13 @@ async def test_properties( async with aiohttp.ClientSession(loop=event_loop) as websession: api = await async_login(TEST_EMAIL, TEST_PASSWORD, websession) camera = list(api.cameras.values())[0] + assert camera.hardware_version == "HAIYI-IMX323" assert camera.last_camera_image_url == "https://path/to/image.jpg" + assert camera.mac == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + assert camera.model == "T8111" assert camera.name == "Driveway" assert camera.serial == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1" + assert camera.software_version == "1.9.3" assert camera.station_serial == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"