Skip to content

Commit

Permalink
Add channel_for_uid method
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG committed May 28, 2024
1 parent c901194 commit ea88734
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions reolink_aio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,15 @@ def camera_uid(self, channel: int | None) -> str:
return "Unknown"
return self._channel_uids[channel]

def channel_for_uid(self, uid: str) -> int:
"""Returns the channel belonging to a UID"""
channel = -1
for ch, ch_uid in self._channel_uids.items():
if ch_uid.startswith(uid):
channel = ch
break
return channel

def camera_model(self, channel: int) -> str:
if channel not in self._channel_models and channel in self._stream_channels and channel != 0:
return self.camera_model(0) # Dual lens cameras
Expand Down

0 comments on commit ea88734

Please sign in to comment.