From 530bde1069cbef652bf9bc615fca64190c9631e2 Mon Sep 17 00:00:00 2001 From: TheYOSH Date: Sat, 27 Jul 2024 18:58:34 +0200 Subject: [PATCH] Update webcam logging --- hardware/webcam/__init__.py | 3 ++- terrariumEngine.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hardware/webcam/__init__.py b/hardware/webcam/__init__.py index 52d18bf4b..29918f959 100644 --- a/hardware/webcam/__init__.py +++ b/hardware/webcam/__init__.py @@ -531,9 +531,10 @@ def update(self, relays=None): if image is False: # Camera is offline!! # logger.warning('Webcam {} has errors!'.format(self.name)) + logger.error(f"Webcam {self} could not be updated after {time()-start:.3f} seconds! Please check your webcam connection.") if self.state: self._device["state"] = False - logger.error(f"Webcam {self} has gone offline! Please check your webcam connections.") + logger.error(f"Webcam {self} has gone offline! Please check your webcam connection.") self.__raw_image = self.__set_offline_image() self.__tile_image() self.__raw_image.save(self.raw_image_path, "jpeg", quality=self.__JPEG_QUALITY) diff --git a/terrariumEngine.py b/terrariumEngine.py index 2cc298fac..ca6070b2f 100644 --- a/terrariumEngine.py +++ b/terrariumEngine.py @@ -1151,7 +1151,8 @@ def __load_existing_webcams(self): def _update_webcams(self): def __process_webcam(self, webcam, current_state, relays): start = time.time() - self.webcams[webcam.id].update(relays) + if self.webcams[webcam.id].update(relays) == False: + return # TODO: Move this code to the webcam itself and pass through variable 'current_state'