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

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

Hi all

I’m getting this error too, after upgrading to 0.92.1 from 0.91.4

Error: Testing configuration at /config
Failed config
  General Errors: 
    - Integration places not found when trying to verify its sensor platform.

I have the places.py file in /config/custom_components/sensor but I don’t know how to write the correct manifest.json

Anyone have already solved this?

Thanks

hi, im using this format for the manifiest.json, it works on all my custom components except places

manifiest.json

{
  "domain": "places",
  "name": "places",
  "documentation": "https://github.com/tenly2000/HomeAssistant-Places",
  "requirements": [],
  "dependencies": [],
  "codeowners": []
}

I’m still running 0.6 so I don’t know how to fix this at the moment. I did see a thread for another custom component where someone said that they had to both create the JSON and add a blank init.py file…

I got the manifiest.json and a blank_init.py file, not working

You have to fill in the dependencies in the manifest.json

{
  "domain": "Sensor",
  "name": "Reverse Geocode Sensor",
  "documentation": "https://github.com/tenly2000/HomeAssistant-Places",
  "requirements": [],
  "dependencies": ["zone","device_tracker"],
  "codeowners": []
}

This worked for me

1 Like

Thanks!!!

It’s working now!

Hi,

Thank you for this… I am very reliant on this component, and it is also again working for me.

Thank you for this post, I really appreciate this, again Thank You…

John

Hi
I can’t install the component when I “check the configuration” I get the error message: “Integration places not found when trying to verify its sensor platform.”

My system file:

  1. "home/homeassistant/.homeassistant/custom_components/sensor/manifest.json
  2. "home/homeassistant/.homeassistant/custom_components/sensor/places.py

My manifest.json file:
{
“domain”: “sensor”,
“name”: “Reverse Geocode Sensor”,
“documentation”: “https://github.com/tenly2000/HomeAssistant-Places”,
“requirements”: [],
“dependencies”: [“zone”, “device_tracker”],
“codeowners”: []
}

My sensor:
- platform: places
name: Test
devicetracker_id: device_tracker.XXXX

What do you think I’m doing wrong?

Thank you!