Fix rpi_camera setup hanging on initialization (#59316)

This commit is contained in:
enegaard 2021-11-10 08:14:16 +01:00 committed by GitHub
parent e20127d9ff
commit 2ae77bd231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,10 +119,13 @@ class RaspberryCamera(Camera):
cmd_args.append("-a") cmd_args.append("-a")
cmd_args.append(str(device_info[CONF_OVERLAY_TIMESTAMP])) cmd_args.append(str(device_info[CONF_OVERLAY_TIMESTAMP]))
with subprocess.Popen( # The raspistill process started below must run "forever" in
# the background until killed when Home Assistant is stopped.
# Therefore it must not be wrapped with "with", since that
# waits for the subprocess to exit before continuing.
subprocess.Popen( # pylint: disable=consider-using-with
cmd_args, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT cmd_args, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT
): )
pass
def camera_image( def camera_image(
self, width: int | None = None, height: int | None = None self, width: int | None = None, height: int | None = None