From 5827a26dfc7a3bebaba3d59e97c1ea7166b7571a Mon Sep 17 00:00:00 2001 From: Luke Pomfrey Date: Mon, 1 Jun 2020 12:15:01 +0000 Subject: [PATCH] Fix handling of min_size argument in OpenCV component (#36335) The OpenCV image_processing component accepts a `min_size` argument in each classifier that is then passed into the OpenCV library. The `min_size` argument is expected to be a tuple of 2 ints, and is entered into the platofrm schema as such. However, yaml will always produce a list instead of a tuple, which means in practice it's impossible to use the `min_size` argument. This changes the schema to accepts any sequence of 2 ints that is then coerced into a tuple suitable for passing to the OpenCV library. --- homeassistant/components/opencv/image_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/opencv/image_processing.py b/homeassistant/components/opencv/image_processing.py index 6b5e4e85513..028d6eacf24 100644 --- a/homeassistant/components/opencv/image_processing.py +++ b/homeassistant/components/opencv/image_processing.py @@ -62,7 +62,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( CONF_NEIGHBORS, DEFAULT_NEIGHBORS ): cv.positive_int, vol.Optional(CONF_MIN_SIZE, DEFAULT_MIN_SIZE): vol.Schema( - (int, int) + vol.All(vol.ExactSequence([int, int]), vol.Coerce(tuple)) ), } ),