Polygon tracker Zones

My FR was closed without referal to this(?) thread.
Anyhow, yes, indeed!

It would be fantastic if we could have the option to create polygon based zones instead of just circular ones.

Node-Red´s “geofencing” is one great example where this can be achieved.

Why one would say?
IoT is growing, myself I have just installed an GPS into my robotic lawn mower (ESP8266+GPS module, running Tasmota). It connects over WIFI and sends lat/lon via MQTT to HA.
I need to know it the robot is on the back yard, front yard or side yard of the house.
Zones in HA are not constructed to be that granular (catering for small yards/zones).

Currently I am using Node-Red and the geofence palette to accomplish polygon based zones and then send the results via MQTT for HA to pick up.

I have never used Node Red, this example looks good. What does it take to pull that off?

What I’d really like to see would be a map displayed with grid lines, so everything is in a square zone. Remember those old Rand McNally maps with letters on the top and numbers on the side? You would look up the street you were looking for in the index, find the page and “square” and eyeball it to find your destination. I’d love to have automatic zones to see objects move from square to square.

I haven’t poked through the code, but I’d imagine you could change the current circular Zone to extend an interface (IZone) and then have all functions that accept Zone accept the interface instead. Then you could create new classes of IZone, such as Square, Poly, etc.

IZone classes would have to implement a function called InZone(long,lat), amongst others.

Hi.

What node red flow did you use to get this to follow mobiles in home assistant ?

I use the Flight24 version of this but it has planes baked into it. How do we get mobiles or companion app involved to monitor if they are in the area or leaving it ?

Thanks

Martyn

More GIS functionality for more advanced geo-fencing with point-in-polygon etc. in HA would be awesome!

Most databases already support spatial datatypes. For SQLite there SpatialLite as an add-on, same with PostGIS for Postgres.

For the geo-stuff there are plenty libs out there for GIS-functionality, and also JS-libs for displaying on the map in the frontend.

1 Like

I’d like to see this also, currently doing it through an integration, but this should be a part of Home Assistant core. My use case is tracking which yard the automower is in and the amount of time it spends in each zone.

map_camera_zone

The standard node red add on for home assistant has a node called geofence or something similar

1 Like

Is there a way to get the geofencing node area into HA as a zone ?

Created a geofence and it works great but would ideally like to show in HA

Thanks

Martyn

1 Like

I don’t think you can show it, but you can probably force a device tracker/person to this zone using the device tracker see service

Right now I’m defining a lot of zones that are very close together, and the solution of using several similarly named circles is fine, but also laborious.

Being able to define zones as a polygon would be a huge upgrade of HA!

+1 for Polygons.

1 Like

Would love to be able to define a zone with corners/end points rather than only allowing a circle.

you have my sword

Lucky I searched. I was going to introduce this as a feature request. I have a zone I use to tell me when my wife is at a certain point on her way home from work. The circle covers too much area when I really just need a zone that covers the freeway she’s on in a rectangular shape.

I also think this would be very useful. because of the circular zone shapes, sometimes I’m forced to include part of the road and it causes false positives for my automations everytime someone drives on that road or is near the edge of the location (buildings and parking lots usually aren’t circles)

A far from perfect but working temporary solution I have found for now if the circle covers too much area is to just create a bunch of small zones with the same name.

I have a working appdaemon app to do this, see here for another FR topic with it in:

https://community.home-assistant.io/t/zones-that-are-not-circles/175914

This has been open since 2017, clearly the dev’s are not wanting to implement this :frowning:

3 Likes

I suppose that this would be more like “the devs don’t think it’s important enought to do it right now but if you are able to do it or willing to pay someone to do it you feel free to have the devs receive a PR to implement the feature”.

2 Likes

We really need this!
It needs to be part of “native” HA - with “year of the voice” combined with the weeks of AI I also think that it would be immensely powerful for HA to know more about things location.

What if there was a way to vote with money or tokens on what should be developed - that would be nice :slight_smile:

2 Likes

Just adding a +1…

In my case, I’m in a rural town. Some areas I’d like to define are farms, which are obviously quite large and mostly not circular. One of them is squarish and far enough out of town that it wouldn’t likely cause issues to just make a circle…

But another is more rectangular and roughly 3 times in length as it is wide. If I create a single circle over that, the error rate would be huge, with either a large part of the ends of the property not within the circle if I go smaller, or a vast area of the zone circle being outside the property if I cover the corners. I could alternatively create 3 circles to get better accuracy, but that makes things more complicated for making use of those zones.

1 Like

Farm use is a great use for this. Being able to define fields that a device is in would be great for creating automations not just in the home.

1 Like