Use the camera UUID as the entity unique id (#44937)

This commit is contained in:
Ryan Fleming 2021-01-10 17:23:32 -05:00 committed by GitHub
parent 4de9f5194f
commit 1402e7ae56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -119,6 +119,11 @@ class UnifiVideoCamera(Camera):
"""Camera Motion Detection Status."""
return self._caminfo["recordingSettings"]["motionRecordEnabled"]
@property
def unique_id(self) -> str:
"""Return a unique identifier for this client."""
return self._uuid
@property
def brand(self):
"""Return the brand of this camera."""

View File

@ -197,6 +197,7 @@ class TestUVC(unittest.TestCase):
self.uvc = uvc.UnifiVideoCamera(self.nvr, self.uuid, self.name, self.password)
self.nvr.get_camera.return_value = {
"model": "UVC Fake",
"uuid": "06e3ff29-8048-31c2-8574-0852d1bd0e03",
"recordingSettings": {"fullTimeRecordEnabled": True},
"host": "host-a",
"internalHost": "host-b",
@ -238,6 +239,7 @@ class TestUVC(unittest.TestCase):
assert "Ubiquiti" == self.uvc.brand
assert "UVC Fake" == self.uvc.model
assert SUPPORT_STREAM == self.uvc.supported_features
assert "uuid" == self.uvc.unique_id
def test_stream(self):
"""Test the RTSP stream URI."""