Skip to content

Commit

Permalink
Raise config exception for duplicate points in zone definitions. close
Browse files Browse the repository at this point in the history
  • Loading branch information
TillFleisch committed Mar 7, 2024
1 parent 22c3242 commit 2fb8ee0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/LD2450/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ def validate_polygon(config):
point_config = point_config[CONF_POINT]
points.append((float(point_config[CONF_X]), float(point_config[CONF_Y])))

if len(points) != len(set(points)):
raise cv.Invalid("Polygon contains duplicate points")

if not is_convex(points):
raise cv.Invalid("Polygon is not convex (and non-intersecting).")
raise cv.Invalid("Polygon is not convex (and non-intersecting)")

return config

Expand Down

0 comments on commit 2fb8ee0

Please sign in to comment.