-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow zone to be a polygon #105729
Allow zone to be a polygon #105729
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
CREATE_FIELDS = { | ||
vol.Required(CONF_NAME): cv.string, | ||
vol.Required(CONF_LATITUDE): cv.latitude, | ||
vol.Required(CONF_LONGITUDE): cv.longitude, | ||
vol.Optional(ATTR_TYPE, default=DEFAULT_TYPE): vol.In(ALLOWED_TYPES), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change requires an architecture discussion.
https://developers.home-assistant.io/docs/core/entity#changing-the-entity-model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create a discussion then. Let's leave this as a draft until a decision is made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's close it until it is approved.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
@Misiu, check your discord, made a thread in the HA discord for discussing polygon stuff |
Breaking change
None, the change is backward compatible, so the user will be able to decide if he wants a circular zone (the default) or a polygon zone.
Proposed change
This PR adds support for creating zones based on polygons.
The code is based on https://github.com/Baael/polygon-zone
The idea was proposed in WTH: https://community.home-assistant.io/t/wth-we-only-have-round-shaped-zones/468137/1
The solution is usingshapely
, but I'm not sure if it will work everywhere, because I found two opinions:home-assistant/architecture#954 (reply in thread)
home-assistant/architecture#954 (reply in thread)
I've used the ray-casting algorithm from https://www.youtube.com/watch?v=RSXM9bgqxJM.
I'd like to get feedback about this approach before I move to frontend and documentation.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: