diff --git a/custom_components/mqtt_vacuum_camera/valetudo/hypfer/image_handler.py b/custom_components/mqtt_vacuum_camera/valetudo/hypfer/image_handler.py index 02e68470..c2f881e4 100755 --- a/custom_components/mqtt_vacuum_camera/valetudo/hypfer/image_handler.py +++ b/custom_components/mqtt_vacuum_camera/valetudo/hypfer/image_handler.py @@ -2,7 +2,7 @@ Hypfer Image Handler Class. It returns the PIL PNG image frame relative to the Map Data extrapolated from the vacuum json. It also returns calibration, rooms data to the card and other images information to the camera. -Version: 2024.10.0 +Version: 2024.11.1 """ from __future__ import annotations @@ -298,7 +298,7 @@ async def async_get_image_from_json( else: _LOGGER.debug(f"{self.file_name}: Frame Completed.") return pil_img - except RuntimeError or RuntimeWarning as e: + except (RuntimeError, RuntimeWarning) as e: _LOGGER.warning( f"{self.file_name}: Error {e} during image creation.", exc_info=True, @@ -375,8 +375,13 @@ async def async_map_coordinates_offset( :param hsf: Height scale factor. :param width: Width of the image. :param height: Height of the image. + :return: A tuple containing the adjusted (width, height) values + :raises ValueError: If any input parameters are negative """ + if any(x < 0 for x in (wsf, hsf, width, height)): + raise ValueError("All parameters must be positive integers") + if wsf == 1 and hsf == 1: self.imu.set_image_offset_ratio_1_1(width, height) elif wsf == 2 and hsf == 1: diff --git a/custom_components/mqtt_vacuum_camera/valetudo/rand256/reimg_draw.py b/custom_components/mqtt_vacuum_camera/valetudo/rand256/reimg_draw.py index 4ff73b88..b7239383 100644 --- a/custom_components/mqtt_vacuum_camera/valetudo/rand256/reimg_draw.py +++ b/custom_components/mqtt_vacuum_camera/valetudo/rand256/reimg_draw.py @@ -1,7 +1,7 @@ """ Image Draw Class for Valetudo Rand256 Image Handling. This class is used to simplify the ImageHandler class. -Version: 2024.10.0 +Version: 2024.11.1 """ from __future__ import annotations