def convertFeetToKm(self, radius_feet):
feet_per_kilometer = 3280.84 # 1 kilometer = 3280.84 feet
return radius_feet / feet_per_kilometer
def isInsideGeoFence(self, device, memberLat, memberLong):
fenceLat = device.pluginProps['geofence_lat']
fenceLong = device.pluginProps['geofence_long']
fenceRadius = device.pluginProps['geofence_radius']
center = Point(fenceLat, fenceLong)
memberPoint = Point(memberLat, memberLong)
distance = great_circle(center, memberPoint).km
return distance <= float(fenceRadius)
ryanbuckner wrote:I was just looking at the code in the plugin.py file and saw the same thing. To double check, I adjusted the radius of HEB (on the app) to 1005 feet. On the plugin, I re-pulled the places data for HEB... it was converted to 0.09332....Hmm, that's strange. Here are the two functions I'm using for feet to km conversion and to determine if a point is within the fence:
ryanbuckner wrote:I was talking about fences. Gets confusing since a fence is physically a circle, but the term Circle is your group of members. Since the "Place" is already contained on the person, I agree, adding the geofence to the person is redundant. I like the list of people in the geofence. That's handy.To answer your other question, are you asking about fences or Circles (which are Life360 specific) . If a person is inside 2 fences , the last fence checked by the plugin will show as positive.
I think what I need to do is remove the fence from the person, since there can only be 1. And check each person from the fence
whmoorejr wrote:You may have to kick someone out of the house to see it. Whenever I start/stop a geofence (make a small change to the device) then that geofence will turn on and show person(s) in it correctly and the other geofence shuts off and shows zero people (incorrect). Now make a small change to that geofence, save, and it turns on with people and the other shuts off. I've done it about a half dozen times now just to be sure.
As for the radius... I've done a couple more changes, like setting my house to exactly 1000 feet in the app and I get 0.09290303....... in the plugin. That works out to about 10763.9 feet pr KM. I'm still playing with the numbers to figure out how or where it's doing the math. The app shows feet on the GUI, are you sure that's what's pulled over? Maybe the backend is already in meters, just the app is in feet because it's a US app?
whmoorejr wrote:The app shows feet on the GUI, are you sure that's what's pulled over? Maybe the backend is already in meters, just the app is in feet because it's a US app?
ryanbuckner wrote:Try installing this... v2022.1.8...
ryanbuckner wrote:For myself, those are the only two I think I'd need or use. Since school is getting ready to start next week, I'm sure I'll have plenty of time to troubleshoot, tweak, etc. The good thing about having a bunch of kids, they will find the flaw in any system.ok. The enter / exit timestamps probably need some logic updates. Currently it only tracks the timestamp of the first person to enter a fence, and the timestamp where the last person left. Unlike FindMyFriends, I won't know when someone entered a geofence or how long they've been there. without somehow keeping track in the plugin.
if (memberCount > 0):
if (prevMemberCount == 0):
firstEnteredTimestamp = cur_date_time
device_states.append({'key': 'first_entered_timestamp','value': firstEnteredTimestamp })
elif (memberCount == 0):
if (prevMemberCount > 0):
lastExitedTimestamp = cur_date_time
device_states.append({'key': 'last_existed_timestamp','value': lastExitedTimestamp })
ryanbuckner wrote:I think what I need to do is remove the fence from the person, since there can only be 1. And check each person from the fence
if (memberCount > prevMemberCount):
lastEnteredTimestamp = cur_date_time
device_states.append({'key': 'last_entered_timestamp','value': lastEnteredTimestamp })
ryanbuckner wrote:ok I'll leave it for now. Anything else you can think of before I log off for the night?
Users browsing this forum: No registered users and 2 guests