Done just check the latest commit on GitHub.
This is great! One question – how do you set it up to work on two origins?
Another option would be to make the street name / address clickable, which would open up in, say, Google Maps, which is much more robust than OpenStreetMap.
I would also love to be able to detect when a device_tracker is in significant motion (like jumping further than X km over Y time) versus mostly in the same location.
Like this
- platform: google_geocode
name: Michael
api_key: XXXX_XXXXX_XXXXX
origin: device_tracker.mobile_phone
options: both
- platform: google_geocode
name: Donna
api_key: XXXX_XXXXX_XXXXX
origin: device_tracker.mobile_phone_2
options: full
Brilliant idea! Have you seen that done in another component? If so which one. I can’t think how to do it of the top of my head but if another component had it I could work out how to do it.
I haven’t! But I asked earlier today here if anyone had any ideas: Location sensing: moving between zones
Also can you make the home has a capial H? Also I know with the old script it would update with automations how does this one update and how often? I’m sorry for all of the questions
This looks really interesting. Unfortunately I need to secure my owntrack setup before I can try this, but I sure will!
As for features, I would like to see just the city unless it’s in my “known cities” (a list?) where showing only the street is sufficient. When abroad, just city and country
I can also see the usefulness of a “current speed” as an indication of “in transit”.
By secure what do you mean? Just out of curiosity.
I’ll fix the capitalisation issue in home tomorrow.
The sensor updates every 60 seconds. It checks if you are in a zone. If you are it will display the zone name. If you are showing as not_home it will take the gps coordinates and query google. Then on the next pass it will check if the coordinates have changed. If they have it will query google again. This really save on api calls I use about 30-40 calls a day for each sensor. Out of 2500 potential calls. I’m tempted to change the update frequently to 30 seconds. Do you think the update frequently needs to be quicker than 60 seconds?
IDK yet. I was just curious. It’d be nice if there was a way to manually specify, but default to 60.
The global scan_interval option will give the user the option to make it update quicker. It won’t work in my component at the moment but I’ll add it in tomorrow.
Works like a charm on first attempt, thanks for sharing!
Great Job! Works like a charm! I was just thinking of doing the same, and you beat me to it and saved me time
Wrong wording, securing my mqtt broker, not owntrack
I have a mosquitto broker on my local LAN that uses the default settings with no encryption so I’m trying to setup bridging using an extra Mosquitto broker with TLS, certificates and passwords before letting anything in through the firewall.
Just an FYI that you can run this without an API key by using maps.google.com instead of maps.googleapis.com. I have no idea what this impacts otherwise but it’s how I use it via tasker on my phone. From what I can tell it’s the older v2 of the API that’s been retired. And then just delete the API reference everywhere in the .py script. (and you’ll notice I also dropped the " + “&result_type=street_address” + “&key=” + api" off as well.
url2 = "https://maps.google.com/maps/api/geocode/json?latlng=" + lat
I have posted a new commit to GitHub. It has fixed the zone capital letter issue and added in the option to use scan_interval. Keep the ideas coming and I will see what I can do.
I found using this option gave me the same results in the correct positions every time. Not having it in some locations changed the order of where street and city was. I’ll have a look at not using a api key. It will make the user process a whole lot easier and make it more accessible. Thanks for pointing this out.
I just tried it without the api key and it worked first time. This will make a huge improvement to my component. I’m going to test it today and then upload it if it works as expected. Do you know what rate limits it has? How often do you query it with tasker?
I only use it once per day via Tasker for a “what state was I in that day” update to a google doc. (I live in 2 states and work in a 3rd - it’s complicated).
I found a few references to 15k calls for v2 and that it apparently uses cookies.