Reverse Geocode Sensor ("Places") using OpenStreetMap - custom component

sorry to report, i’ve had to disable this component for now.

Running hassio/hassos 0.80.0b0 it causes frequent spontaneous restarts, and upped the battery-drain significantly. Which is too bad, cause I really liked the extra functionality this CC offers, and I had hoped this to be an improvement on the iCloud tracker on exactly that battery-aspect.
Must admit I haven’t played around fully with the extra settings and attributes, which I simply had loaded fully. Taking a few out there could alleviate the street maybe, but as said, I haven’t tested that.

If Ha is on a next release version I will test again, and I hope maybe this component has seen further development and will have improved on the processor/memory usage by then.
Cheers!

for your information. I changed my static map to this site. it’s working fine. 15000 calls a month for free.

Yes thanks , I’ve seen that and tried it . Was a bit hesitant to give my gps coordinate tonyet another ‘free’ service…

Would you know what to do with the built in map urls (Google or apple )? They are fine to load in a separate browser window but do nothing in a camera still image?

Would love to be able to use the apple maps feature like we can use Google maps, but I haven’t been succesful doing so with these urls .
Maybe you know how to?

Hi Marius,

Sorry I haven’t gotten back to you on your other questions - and I doubt I’ll be able to before early November due to an unusually heavy workload at my real job.

However, the Places component does not and can not impact your devices battery life at all. It triggers off of changes reported by DeviceTracker entities - so whatever mechanism you are using to track your location is what is responsible for the battery-drain. I found that to be the case when using the iCloud tracking and ended up implementing a solution using OwnTracks which doesn’t update as frequently - but is still useful. But in any case - the “Places” component does not request updates from your device, it just responds to the updates that your device sends to DeviceTracker.

My static maps (that used to work) also no longer work. I haven’t researched why - but I’d be surprised if it were linked to the HomeAssistant version that you are using. It’s almost certainly linked to a change made by Google.

But regardless as to whether you are still using the component or not, when time permits, I’ll look at your questions and suggestions and try to address them.

1 Like

ok thanks I appreciate that, and am looking forward to the development this component would make, as said I really like its functionality,

About the battery: will investigate further, indeed it seems strange if it only would feed off the devices I already have.

You mention Google, not the Apple map. How could I use that? Should it work in a camera: generic setting? Or is it intended for other use.

thx,
Marius

Hi Marius,

When I created the map links, my intent was to be able to push those links in an email or twitter notification.

I had also created a couple of generic map sensors in the Home Assistant UI, but for those map images, I just googled for the correct URL format and then inserted the latitude and longitude from the device tracker entity - because the DeviceTracker is the authoratative source for lat/long. Places and other sensors may cache that information - but deviceTracker is the right place to pull it from.

Hello. A quick question: I have created large zones in my HA setup to cover entire communities in my area. If I am reading the earlier posts correctly, I will be unable to use this custom component to give me the street address when the device tracker is in a zone? If so, is there a workaround to overcome that? Thanks!

I have recently updated to 0.86.6 and am having issues with the Places Sensor. Specifically I am seeing messages to the effect that update of the sensor failed.

I’ve attached some of the log file showing the messages that are received:

2019-01-04 13:13:20 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.places
2019-01-04 13:13:20 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.places
2019-01-04 13:13:20 INFO (SyncWorker_0) [custom_components.sensor.places] (Alan) DeviceTracker Entity ID is Alan_iphone
2019-01-04 13:13:20 INFO (SyncWorker_4) [custom_components.sensor.places] (Jenny) DeviceTracker Entity ID is jenny_2b6492a72cb74fad9a6ac718fd25c566
2019-01-04 13:13:20 INFO (SyncWorker_0) [custom_components.sensor.places] (Alan) Now subscribed to state change events from device_tracker.alan_iphone_
2019-01-04 13:13:20 INFO (SyncWorker_4) [custom_components.sensor.places] (Jenny) Now subscribed to state change events from device_tracker.jenny_2b6492a72cb74fad9a6ac718fd25c566
2019-01-04 13:13:51 INFO (SyncWorker_1) [custom_components.sensor.places] (alan) Calling update due to Scan Interval
2019-01-04 13:13:51 INFO (SyncWorker_1) [custom_components.sensor.places] (alan) Check if update req’d : device_tracker.arpainter_iphone_
2019-01-04 13:13:51 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.alan fails
File “/config/custom_components/sensor/places.py”, line 432, in update
File “/config/custom_components/sensor/places.py”, line 462, in do_update

I have Version 1.2 of the Places sensor which seems to be the latest version on Github. Any advice as to what I need to update to have this sensor working with 0.84.6?

Can I ask you, how you integrate this to home assistant?

Hope this project continue with the updates

Hello all,

I have been using this component for a while and it is great. I would like to use the place name (I think it is called this) as the display option. When I specify place_name as the option the component stops working for anyone not at home.

Here is an example position:

formatted address

Dunkin’ Donuts, Ti Rakau Drive, Greenmount, Howick, Auckland, 2013, New Zealand/Aotearoa

place type -
place name -
place category -
neighbourhood -
previous latitude -37.18726
previous longitude 174.918212
current latitude -36.9295065
Current longitude 174.9097463

The formatted address has the place name but the place name is empty in the details of the tracker.

I have the latest version 1.2.

Current format in configuration:

  • platform: places
    name: Karengoogle
    devicetracker_id: !secret
    options: street
    api_key: !secret

I have tried the following:
options: place_name

which breaks the component.

Cheers, Matt.

Hi Matt,

Place_Name is not a valid option string. The full documentation is on github (link in the first post of this thread), but here is an excerpt that shows the valid options that can be used:

  • State display options are (default “zone, place”):
    “zone, place, street_number, street, city, county, state, postal_code, country, formatted_address”

If you don’t specify an option at all, the default is “zone, place” but try setting option to place and let me know if it still doesn’t work.

Honestly, I’ve been working on an iOS app (personal project) and have not even looked at this component or updated my own Home Assistant version in at least 6-8 months.

But i do see a few posts besides yours that I haven’t responded to. I will try to get to them this week also.

Thanks,
Jim

Thanks Jim. I am using street as an option which works well and just gives the street. Place gives me a long formatted address so I will stick to using Street. I am using it on a tablet and having a short large text to glance at is handy. Thanks for the effort on the component.

Cheers.

Hi Jim,

I sorted out using place names in this component. I am using an additional sensor which strips out the place name from the formatted address. I then combine it into another sensor so that it gives zone as the first option, place name as the second option and then street as the third option in order of priority.

Cheers, Matt.

1 Like

Tried to install this custom component this evening. HA not having it.
/config/custom_components/sensors/places.py installed
loader.py says: Unable to find platform places

Sometimes when I restarted home assistant, the Sensor won’t load this is the log

Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state await self.async_device_update() File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update await self.hass.async_add_executor_job(self.update) File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run result = self.fn(*self.args, **self.kwargs) File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 315, in wrapper result = method(*args, **kwargs) File “/config/custom_components/sensor/places.py”, line 417, in update self.do_update(“Scan Interval”) File “/config/custom_components/sensor/places.py”, line 447, in do_update distance_m = distance(float(new_latitude), float(new_longitude), float(home_latitude), float(home_longitude)) ValueError: could not convert string to float: ‘None’

Sorry, I didn’t see this before I posted an issue on GitHub. I’ll watch and see if you get around to looking at the issue.

hi, with the update to 0.92, the component stops working, just open a issue on github, i get this in the log

Error while setting up platform places
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/places/sensor.py", line 297, in setup_platform
    add_devices([Places(hass, devicetracker_id, name, api_key, options, home_zone, map_provider, map_zoom)])
  File "/config/custom_components/places/sensor.py", line 317, in __init__
    self._entity_picture = hass.states.get(devicetracker_id).attributes.get('entity_picture')
AttributeError: 'NoneType' object has no attribute 'attributes'
1 Like

Look at this:


I works for me

Thanks, I already did that to all my custom components and this is the only one, that even with the manifiest.json won’t work