IPhoneLocator and Google Map

In June 2018 google changed the billing model for their map and distancematrix API service. depending on your region you may have been impacted at different times. you will see that if you get persistent google quota exceeded messages or a grey background map display with a “for development only” message.

IPhoneLocator v2.48 (soon published on app store) introduces a new variable GoogleMapKey which must be initialized with your own google map api key value that you can get from the google map page Google Maps Platform - Location and Mapping Solutions. This key is needed to allow the API calls to DistanceMatrix and Geocode API as part of each “refresh” loop call and to display the map in the settings tab.

Depending on your usage patterns and number of iCloud devices you may have more or less consumptions of the google api and this could have a cost if the total exceed 200$ ( the first 200$ are not charged by google )

so Please before using this, read the Google map key section in the document http://code.mios.com/svn/mios_iphone-detector/trunk/iPhoneLocator/Another%20UI7%20Install%20doc.pdf or GitHub - amg0/IPhoneLocator: IPhone Locator plugin for Micasaverde VERA and openLuup to understand and estimate the cost consequences and have an example of an average use ( mine )

please be mindful about these informations and eventually set a maximum quota in google cloud console if you have doubts as IPhoneLocator cannot be hold responsable for unforeseen costs.

Hi Amg0
Thank you for your hard work keeping up with all the changes with Apple/Google.

I updated to v2.48, and went to Google to get my API key.
I can’t find where to put it in your App.

My wife has an iPhone on a separate account. Do I need to set up a separate API for her?

Also, what Polling settings do you recommend that will give your app maximum efficiency without getting charged?

Jim

[quote=“jimmyhtz, post:2, topic:199791”]Hi Amg0
Thank you for your hard work keeping up with all the changes with Apple/Google.

I updated to v2.48, and went to Google to get my API key.
I can’t find where to put it in your App.

My wife has an iPhone on a separate account. Do I need to set up a separate API for her?

Also, what Polling settings do you recommend that will give your app maximum efficiency without getting charged?

Jim[/quote]

Variable GoogleMapKey in device iPhonelocator.
I have 3 instanc3s on three different iCloud accounts, I use the same apikey and seems below the max free tier every month, but I mute the devices during the night and unmute them when the entry door of the house is opened.

day one of this setup.

what would you recommend the quota cap be so google doesnt charge me when i reach the $200. Dont think i will based on what im seeing in the last few minutes of it being set up.

Do you recommend any “Application Restrictions” though google? Its asking me to secure it more

Thanks

[quote=“deboy69, post:4, topic:199791”]day one of this setup.

what would you recommend the quota cap be so google doesnt charge me when i reach the $200. Dont think i will based on what im seeing in the last few minutes of it being set up.

Do you recommend any “Application Restrictions” though google? Its asking me to secure it more

Thanks[/quote]

aside managing budget and alerts in the google cloud console, I am not aware of other means to control it
I recommend you keep an eye and have a MUTE strategy during the night for instance

thanks

Hi, so thanks for getting this working again. Just signed up for the google APIs and it seems to work ok. Some basic things I learnt in setting this up:

  1. The APIs the iphone locator uses SEEM to be Geocoding API and MAPS Java Script API. I think the last is for the built in map in the settings.
  2. I set up a specific Vera Project in the Google setup – so I can restrict it as much as possible. The API key is in this project.
  3. For restrictions I enabled ONLY the above APIs. Note that it kept failing until I enabled the Geocoding API (disabled by default).
  4. I also restricted the number of calls in EACH enabled API – Click on the API to get details and then the Quota tab. Set the values as needed (they are initially unlimited).

Now to my question:

I am trying to restrict on IP access to the key – so its ONLY my Vera that can use this. Anyone know WHAT this IP might be? I am behind a NAT’d Verizon router so I am ASSUMING its the Verizon router IP but am not 100% sure. Anyone know? I’ll play some more and return here if I figure it out.

I just set this up with an API key, entered it in the correct variable area and am getting “Google returned an error code” message in my iPhone device when I try to refresh the location. Any ideas??

have you enabled debug mode and checked the log ? if not that is probably the next step. it could be related to quota management if you did a lot of request or reload recently

@amg0

I turned on debug mode, but being I’ve never used it, where do I go to check the logs? I just signed up for the API key so I don’t think a request overload is the issue. When I look on the map in the iPhone device it does show the location of my iPhone but I’m still getting the error.

I’ve been having issues throughout the day with commands failing for my iPhone device and my wife’s where I’m trying to mute/unmute and getting “command failed” errors, so I’m not sure if all this is related somehow.

[quote=“agoodman82, post:10, topic:199791”]@amg0

I turned on debug mode, but being I’ve never used it, where do I go to check the logs? I just signed up for the API key so I don’t think a request overload is the issue. When I look on the map in the iPhone device it does show the location of my iPhone but I’m still getting the error.

I’ve been having issues throughout the day with commands failing for my iPhone device and my wife’s where I’m trying to mute/unmute and getting “command failed” errors, so I’m not sure if all this is related somehow.[/quote]

it could be related if your vera has stability issues… log would tell.
how to get the logs is said in the FAQ post : http://forum.micasaverde.com/index.php/topic,18822.0.html

@amg0

I was looking for alternatives to google map to calculate distance and travel time and found the following:

and openstreetmap which can be localized:

Would you consider supporting any of them?

Hello Rafale77

I do not think I will modify this for now but I will be happy to integrate any proposed code for it

Best Regards
Alexis

I forgot to comment back here that I was finally able to get the location to show up in my iPhoneLocator apps. As twiseva had posted, you need to manually enable the Geocoding API after generating an API key; it’s disabled by default, and that was returning a “Google returned an error code” for me.

2 Likes

My google account now says that my free trial is over and so iPhone Locator is now showing an error in the location even though the distance still seem to work. I am a bit too busy at the moment to do it but will try to find the time to use another distance/travel time platform.

that is very weird, I have 3 instances daily and never run out of the free tier. have you created your key and entered it in the plugin variables ? do you have too many polling or another app that use the same api ?

Yes I have been using it for months and no I have not been running out of calls on the free tier. Now the monthly limit just became 1 call forcing me to purchase a license.

It is interesting that the ETA and the distance still are being reported and only the location shows “Google returned and error”. It seems to indicate that one of the services only has been limited but when I go look at my account, It indicates that both are limited to one call and that since mid September, it has been returning 4xx http codes.

My google map has definitely expired and gone down to 1 call a day. Looking into how iPhoneLocator polls I understand now the the distance and ETA was from iCloud and not from google map. I started getting it to work on traveltimeplatform but I think I will move to bing map instead as it offers a much larger number of calls in its free tier.

Humor me but after spending a large part of two days learning and adapting the plugin to bing maps (and finally succeeding), I just discovered Here Maps which seems to be a much better solution with a free tier of 250K transactions per month vs 20K for Google and 10K for bing…

Well that’s more work for me…

1 Like

I wonder if the plug-in can give you options - one of the three. @amg0, what do you think? It could allow one device to use Google, one to use Bing, and a third to use Here. It could spread the calls out to 3 services. Just thinking out loud.