diff --git a/homeassistant/components/rpi_camera/camera.py b/homeassistant/components/rpi_camera/camera.py index 980586d4def..89fe7fe55d8 100644 --- a/homeassistant/components/rpi_camera/camera.py +++ b/homeassistant/components/rpi_camera/camera.py @@ -119,10 +119,13 @@ class RaspberryCamera(Camera): cmd_args.append("-a") 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 - ): - pass + ) def camera_image( self, width: int | None = None, height: int | None = None