gcobb321 / icloud3

iCloud3 v3 - iCloud3 is an advanced iDevice tracker that uses Apple iCloud account and HA Companion App data for presence detection and location based automations.
MIT License
542 stars 54 forks source link

Confusion on Enter/ Exit #370

Open barney34 opened 4 weeks ago

barney34 commented 4 weeks ago

I have the logic for when "Daddy iPhone ZoneName" changes from NotHome to Home to perform an action. However if I go on a walk and leave the Home zone and stand within 200 feet of the zone after I am considered NotHome the event triggers between Home NotHome after the cool down period of 30 seconds. I tied to use the logic in the examples of "sensor.daddy_iphone_home_distance) with attribute "max_distance >x" but when does max distance ever change. What value changes as I leave the home so I can say when x value is > y then run the script. And visa versa when coming home when a value was > x. All this do the automations dont constantly flip flop. Seems like it would be super easy if the max_distance reset when you reached home.

If:

NotHome to Home and maxdistance was >x execute command

If

Home to Nothome and maxdistance was 0 execute command

gcobb321 commented 4 weeks ago

As I recall, the max distance is set when you are away from home and the home distance is > than the current max distance. It is reset when you leave home. Instead of using the max_distance, also try the home_distance went_3km attribute. It is set to True when you leave home and go over 3km. It is reset to False when you enter the Home zone. The went_3km combined with the distance will help prevent those false triggers.

barney34 commented 4 weeks ago

ok thats closer. can I modify the 3KM?

barney34 commented 4 weeks ago

and my max distance does not reset when I leave home if that happened that would work as well.

barney34 commented 4 weeks ago

I guess I can create my own toggle based on calculated distance to act like the went_3km flag. Let me try that

barney34 commented 4 weeks ago

@gcobb321 last question I think I figured it out by turning on entity calculated distance. But why when wife enters a zone that is not "TrackFromZone" for here device inside iCloud3 and she doesn't have the MobApp does the tracking of here device get set to 15 min. Log says Lastlocated changed to @zonename-1:30:50p then NetsUpdate changed to 1:45:50

gcobb321 commented 4 weeks ago

Configuration > Update Devices screen > your wife > Inzone Interval value is probably set to 15 mins

barney34 commented 4 weeks ago

ok so I just need to delete the zone then because I want to turn it off and since its not tracked but still counted it hurts

gcobb321 commented 4 weeks ago

I'm confused by what you are trying to do now. Maybe I didn't understand the previous question. The tracking results can get very complicated due to the many situations and I have not dug into the inner workings for some time.

barney34 commented 4 weeks ago

when I leave the house shut the gargage and when I get home open it up and wifes iphone doesnt have the mob app. The problem is no matter what I use our phones drift in and out of Home NotHome or direction towards to away and visa versa. I have the home zone small because I dont want the garage opening when I am on the lake or at the neighbors. So I am trying to find a variable to use and if the max distance would reset to 0 that would be perfect. I could say if you move from nothome to home and max distance was above 0.1234 then it will work or if your maxdistance is y then close the garage but max distance never reset so I cant use that value its always some number.

gcobb321 commented 4 weeks ago

The automation I use to open my garage door is here. My Home zone radius is 100m and I have the Mobile App on my phone and my wife’s phone.

You have a couple of issues going on - A small Home zone radius. That is what will cause gps drifting in and out of the home zone. iCloud3 tries to prevent this using the zones size. It will not exit the zone until you are 2 times the zone’s radius away. It does not look at the gps accuracy. It will ignore a location with agps accuracy above the value in the config. If the distance is greater than 2x the size, it will exit the zone.

The mobile app makes things a little easier by also providing zone enter and exit triggers.

I trigger the door to open if I enter the Home zone and the max distance > 3 and I am less than .35mi from home or when I enter the zone from a location update or a mobile app enter trigger.

Not using the mobile app can/will lead to the door not opening since you are relying on a timely location request from Apple. The mobile app knows where the device it’s and issues a trigger. If you don’t use the mobile app and a location request is not made, then nothing will happen because iCloud3 does not really know where you are. It would be using your last known location.

I’m using NabuCasa for my external communications. It was easy to set up, works and it’s cheap.

There may be a way for you to create a distance sensor you set when the max distance is > x and reset it when you enter Home using your own script that changes when you want it to. Then use that in your automations.

barney34 commented 4 weeks ago

Thank you. This is what I will do. But if you ever want to take a donation to reset max distance I’d be game. If you ever drive under two, your Max distance is still three so I don’t see how it’s been value if it never resets but thank you so much

“ There may be a way for you to create a distance sensor you set when the max distance is > x and reset it when you enter Home using your own script that changes when you want it to. Then use that in your automations.”