just added this works really well !
@michaelmcarthur one questionā¦
In my home i have two cellphones.
1 is mine other is my wife.
I need two apis?
I ask it because i put the same api.
And the home assistant tell me the exacly adress where i am, and my wife also with me and home assisant tell me that she is another street.
You donāt need two APIās. The different addresses will be to do with when the last update from the device tracker was sent. Google matches the gps coordinates to the nearest street. You and your wifeās phone will have updated their locations at two different coordinates. You can test it by putting the lat Lon from your device tracker into google maps and see where it thinks each of you are.
is this still custom_component or integrated now?
custom_component
Itās still a custom component. I would love it to be integrated. I built this component to learn python. Iām now struggling to get the component past the formatting rules set out by home assistant. If anyone can help with the submission head over to my github and your help will be greatly appreciated.
Great work love this component can see where my wife is on her short walk to the car and reports the location spot on !
Hello @michaelmcarthur!
Thank you for your great work.
Is it possible to customize āoptionsā order.
In my country address starts from city, than street and number.
Yep, you can do that by creating a template sensor. Look back in the comments Iām sure someone else asked about this.
Edit. Look at comment 141. You can adapt it to do what you are wanting
Thanks for this share.
I have 2 device trackers and would like them to work as a single entity showing my location as to where I am. How can I show that?
In othe words what I am trying to ask is that in origin can we use group instead of device tracker?
Thanks.
@bachoo786 This is why I love the home assistant community as I would have never of thought to do that. I get why you would want to do it. Itās not possible to get a group location as there is no lat lon coordinates on them. I have an idea how to achieve what you are looking for. You could create a google Geocode sensors for each of the trackers then group the sensors together. The group state should be of the last updated sensor. This is not tested but might work.
@michaelmcarthur well I just configured another device tracker and thought of asking you
so what I did was to use the same google geocode sensor of my first device tracker for my second device tracker and just changed the origin
part i.e.
- platform: google_geocode
name: michael
origin: device_tracker2.mobile_phone
options: street_number, street, city
display_zone: hide
gravatar: [email protected]
api_key: XXXX_XXXXX_XXXXX
I then group the 2 sensors in a group say X and then group again the group X into another group say Y.
Everything works fine in group Y except that the state of group Y does not change and remains unknown
. However, the state of the 2 sensors do change in group Y according to google geocode.
Do you know what could be the issue?
I had a look into how groups work. They have been coded so if device trackers are in the group they will show the last updated tracker as the group state. If you put a sensor in the group it shows as unknown. But I have a solution. You can create a template sensor.
- platform: template
sensors:
my_tracker:
friendly_name: "My Tracker?"
value_template: >-
{% if as_timestamp(states.sensor.tracker_1.last_changed) | float < as_timestamp(states.sensor.tracker_2.last_changed) %}
{{states.sensor.tracker_1.state}}
{%- else -%}
{{states.sensor.tracker_2.state}}
{% endif %}
This should give you what you are looking for.
Please add me as a +1 vote for the Places capabilities.
It would be great to see a restaurant name, shopping mall, store name, etc instead of an address when those things are available.
Iām just in the process of trying to enable the geocode component - so I canāt say āgreat jobā just yet - but I expect to in the very near future. For now, put me down as a āThank you very much for developing this component!ā. Even without Place names, this will be so much better than displaying ānot_homeā whenever someone is outside of a zone.
If you mean like this. it is in the cookbook
Need help figuring out whatās wrong with this componentā¦
I followed the instructions on the Github page and copied the component into the config/custom_components/sensor directory. I also made the documented configuration.yaml entries and created a āpeopleā group - then restarted Home Assistant.
Everything appears to be working properly - but I know thatās not possible on the first try with a Home Assistant component - so where do I look to find something thatās broken? Seriouslyā¦ It canāt be this easyā¦ can it?
@michaelmcarthur Fantastic job with this component. It really is the first component Iāve enabled that has worked perfectly on the first try. Iām amazed at how easy youāve made this! Thank you so much!
-
put the google_geocode.py in <config_dir>/custom_components/sensor/google_geocode.py
-
create this in sensor platform
- platform: google_geocode
name: michael
origin: device_tracker.mobile_phone
options: street_number, street, city
display_zone: hide
api_key: XXXX_XXXXX_XXXXX <== from google
gravatar: [email protected] <== from gravatar
- platform: google_geocode
-
You need to register for an API key. by follow the instruction https://github.com/googlemaps/google-maps-services-python#api-keys
-
optional for gravatar register link in his github.
@tenly Thanks for your support of this component. The fact that it works first time is due to the people in the home assistant community. It was a big help getting feedback from everyone on the forums.
@michaelmcarthur so I implemented the template sensor you gave and the results are very patchy in the sense that it does not select the last changed sensor.
Could we use binary sensor instead? as template sensors have a performance impact I suppose?
So - now that Iāve added this Geocode component, my device_tracker automations are not firing anymoreā¦
I have the following automation that worked prior to implementing the Geocode component - but now it doesnāt.
Is there a simple explanation? A simple fix to get it to start working again? The only thing I changed was that I added the last parameter to the āmessageā to try to get the text to include the formatted address from the Geocode sensor.
- alias: LocateAidan
trigger:
platform: state
entity_id: device_tracker.aidan_iphone
action:
service: notify.ios_my_iphone8
data_template:
title: Location Alert
message: >
Aidan: {{ now().strftime("%Y%m%d-%H%M%S") }} Location changed from {{ trigger.from_state.state }} to {{ trigger.to_state.state }} ( {{ sensor.G_Aidan.attributes.formatted_address }} )
data:
attachment:
content-type: jpeg
push:
category: camera
entity_id: camera.location_aidan
Thanks in advanceā¦