iCloud3 v2.0 Device Tracker - Advanced tracking features with HA iOS App integrated monitoring (Updated)

Hello there,

What if I live out of the existing Waze Regions? Can I still use icloud3 setting distance_method calc?

BTW, I’m in South America.

Thanks @gcobb321 for the great code!

Regards,
Tales

Could I use this tracker for the following scenario

If I’ve gone from driving to not driving for X minutes, trigger an automation.

The goal is to run a routine when I’ve probably stopped somewhere and gotten out of my car. I currently run the routine when I enter specific zones for 10 minutes, but it looks like maybe I could use this the same way but with the “dynamic zones”. But I dont want just any dynamic zone, only if I was obviosuly driving somewhere.

this code uses WazeRouteCalculator, I believe that considers south Africa as EU. Also, the region only matters if you are putting in an address. If you have GPS location (lat, long), it shouldn’t matter what region you are in.

Thanks, it’s South America and not South Africa, but I got it. Will use US as the region then.

Cheers
Tales

Ah, ok then use US. It’s the same deal.

EDIT: I don’t know why, but I thought I read “South Africa”.

@thermseekr Yes, you can use the ‘calc’ method and Waze will not be used at all.

@ptdalen I suppose you could trigger an automation is entering a Stationary zone and are X miles from home. Or set up several zones for places you normally drive to. I set an input boolean.driving_flag if I’ve gone 2 miles and check it when I get home to open the garage door. This prevents it from opening when I just walk across the street.

Hope that helps a little.

what my ultimate goal for this is to run a routine to lock my car remotely. I sometimes forget to lock my car, and I have an automation that does that when I get home, but have never set it up to run when I’m away from home. My thought is, if my speed was above 20MPH then goes to a stopped speed for X minutes, then lock my car doors. No need to run the automation again, unless I increase me speed up above 20mph again. 90% of the time it would be at work in a zone, but once in a while I might be shopping, etc.

Hello

Started with default settings (using Waze). As soon as I left home zone for the first time HA started logging errors:

2019-03-05 18:01:47 ERROR (SyncWorker_14) [custom_components.device_tracker.icloud3] ►►Error on retrieving data: Internal Error

Despite the errors the service kept working as I could confirm my mobile reentering home zone and triggering automations after 1,5 hour. I left home again and after another few hours I noticed the UI was unresponsive. Checked logs through my VPN and could see tons of warnings about other components timing out.

Sorry if this is known already, as I just got home I haven’t checked all the posts. Will disable Waze and restart.

Regards,
Tales - thermseekr

Complementary info:

Even tho distance_method was default, I could see in the tracking info that Waze and Calc distances were always the same. Apparently Waze was actually not being used.

I had tried icloud3 a few weeks ago and got similar errors. At the time I wasn’t able to do further testing so I left it alone. Today when resuming I was not asked to reauthorize access to iCloud account.

Confirmed this morning. Issues start as I leave home zone for the first time, and lead to the UI halting. I stopped icloud3 for now.

That error is from WazeRouteCalculator and is an error directly from the waze API itself. It is unavoidable. WazeRouteCalculator uses an unofficial API and this is a direct result of that. In my personal opinion, after developing most of the current waze_travel_time component using WazeRouteCalculator, the unofficial API is crap. Unfortunately, the official API costs money. So, you pretty much have to deal with this error, unless you want to buy and pay for the official API support and build a new library that replaces the WazeRouteCalculator.

EDIT: I do want to clarify that I don’t know much about this iCloud3 component. I can say that the WazeRouteCalculator routinely returns 2 errors: None (Not an error, just no response), and Interal Error. The dev of this custom component should find a way to gracefully continue with these errors occurring regularly.

@petro I’ve tightened up a lot of the code and added substantial error trapping so these errors should be prevented going forward. I just pulled down the latest release and noticed a new region. I’ll make the necessary changes to iCloud3 before it is released. And I hadn’t checked the contributors of the HA waze component and given them credit for the interface I used as the basis of my waze interface. Sorry and will fix that oversight.

@thermseekr, @perto
I’d like you to try the version of iCloud3 that I’ll be releasing in the next few days to see if it fixes all of your problems. Send your email address to [email protected] and I’ll send you a copy.

I’m not faulting your code at all or the WazeRouteCalculator. The real problem in all of this is that we are using an unofficial API. I’ve been mulling over creating an Issue for the WRC for all of it’s none/internal error responses. I think it would be advantageous for it to try to get information for 10 seconds instead of trying 3 different servers and then giving up.

Understand. But my code should take errors and other issues into consideration and act accordingly. Hopefully, I have now done so. There have been times when it takes 7+ sec to update a location. Most of that time is getting the waze information. So I would welcome any activity on this issue.

I added this component yesterday, and can confirm similar behavior. Got to work this morning, checked the component, it still showed me at home. Check again an hour or so later, and it has just updated and showed me at work. Went back in later to check something out unrelated and found my UI is now non responsive.

If you think it’s worth checking: the second test I did yesterday was with distance_method: calc which was supposed to not use Waze, but errors continued. So maybe something in the code is still relying on Waze even after setting calc.

Will inform you my email address now. I’l gladly test the new code and return you the results.

Saluti,
Tales/thermseekr

I see in node-red, the device_tracker state for phones connected to icloud3 are showing up as “home” at first and then a few seconds later “Home” (with capital H). Why is that happening? I have to capture both states in node-red and creates more use cases.

44%20AM

InstigatorX The current version of iCloud3 is capitalizing the zone name. In the next release, it is using the zone name as defined in zone.yaml.

Additionally, there will be a new ‘zone’ attribute with the uncapitalized full name of the zone that may different from the State for two reasons.

  1. The Dynamic Stationary Zone may be ‘gary_iphone_stationary’ but the state will be ‘Stationary’.
    2.The IOS app sends gps info via device_tracker.see service to HA that can update the State before iCloud3 gets it. See does not look at the gps accuracy or the age of the location data. It the age is old (like 5-10 minutes) or gps is inaccurate, the State is still set. If you are in a zone, the gps might have wandered and the State is changed to ‘not_home’ when it shouldn’t be changed at all. When iC3 gets the info, it resets the State to ‘home’ but an ‘away’ or ‘zone change’ automation might have already triggered due to the State change.

I figured it had something to do with what you described. I’m using the version from prerelease directory if that makes a difference.

Should I rename my zone in configuration.yaml to “home” to mitigate the node-red effects of #2? i.e. home to Home state change and having to ensure both are treated same