Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Add additional camera properties (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored Nov 1, 2019
1 parent 3d96437 commit 8c0ce73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions eufy_security/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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."""
Expand Down
4 changes: 4 additions & 0 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down

0 comments on commit 8c0ce73

Please sign in to comment.