Skip to content

Commit

Permalink
try to prevent bug impacting some cameras without the video in mode API
Browse files Browse the repository at this point in the history
  • Loading branch information
rroller committed Jun 26, 2021
1 parent 66b6936 commit 8db524b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom_components/dahua/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,13 @@ async def _async_update_data(self):
# We need the profile mode (0=day, 1=night, 2=scene)
profile_mode = "0"
if not self.is_doorbell():
mode_data = await self.client.async_get_video_in_mode()
data.update(mode_data)
profile_mode = mode_data.get("table.VideoInMode[0].Config[0]", "0")
try:
mode_data = await self.client.async_get_video_in_mode()
data.update(mode_data)
profile_mode = mode_data.get("table.VideoInMode[0].Config[0]", "0")
except ClientError as exception:
# I believe this API is missing on some cameras so we'll just ignore it and move on
pass

# Figure out which APIs we need to call and then fan out and gather the results
coros = [
Expand Down

0 comments on commit 8db524b

Please sign in to comment.