Skip to content

Commit

Permalink
Use the camera UUID as the entity unique id (home-assistant#44937)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfleming71 authored Jan 10, 2021
1 parent 4de9f51 commit 1402e7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions homeassistant/components/uvc/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ def motion_detection_enabled(self):
"""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."""
Expand Down
2 changes: 2 additions & 0 deletions tests/components/uvc/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def setup_method(self, method):
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",
Expand Down Expand Up @@ -238,6 +239,7 @@ def test_properties(self):
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."""
Expand Down

0 comments on commit 1402e7a

Please sign in to comment.