1
mirror of https://github.com/home-assistant/core synced 2024-09-12 15:16:21 +02:00

Fix UVC doing I/O inside the event loop (#35169)

This commit is contained in:
Franck Nijhof 2020-05-05 03:02:09 +02:00 committed by GitHub
parent f885e97a5b
commit a3071571ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,11 +192,7 @@ class UnifiVideoCamera(Camera):
def set_motion_detection(self, mode):
"""Set motion detection on or off."""
if mode is True:
set_mode = "motion"
else:
set_mode = "none"
set_mode = "motion" if mode is True else "none"
try:
self._nvr.set_recordmode(self._uuid, set_mode)
@ -215,9 +211,7 @@ class UnifiVideoCamera(Camera):
async def stream_source(self):
"""Return the source of the stream."""
caminfo = self._nvr.get_camera(self._uuid)
channels = caminfo["channels"]
for channel in channels:
for channel in self._caminfo["channels"]:
if channel["isRtspEnabled"]:
return channel["rtspUris"][0]