Places
Component to integrate with OpenStreetMap Reverse Geocode (places)
Install / Use
/learn @custom-components/PlacesREADME
places
<picture> <img alt="places Logo" src="https://github.com/custom-components/places/raw/master/logo/icon.png"> </picture>[![GitHub Downloads][downloads-shield]][releases] [![GitHub Latest Downloads][downloads-latest-shield]][releases] [![GitHub Release][releases-shield]][releases] [![GitHub Release Date][release-date-shield]][releases] [![GitHub Activity][commits-shield]][commits] [![Coverage][coverage-shield]][coverage] ![License][license-shield] [![hacs][hacsbadge]][hacs] ![Community Forum][community-forum-shield]
Component to integrate with OpenStreetMap Reverse Geocode and create a sensor with numerous address and place attributes from a device_tracker, person, or sensor
Installation
HACS (recommended)
- Ensure that HACS is installed
- Click Here to directly open
placesin HACS or<br/> a. Navigate to HACS<br/> b. Click+ Explore & Download Repositories<br/> c. Find theplacesintegration <br/> - Click
Download - Restart Home Assistant
- See Configuration below
You probably <u>do not</u> want to do this! Use the HACS method above unless you know what you are doing and have a good reason as to why you are installing manually
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml) - If you do not have a
custom_componentsdirectory there, you need to create it - In the
custom_componentsdirectory create a new folder calledplaces - Download all the files from the
custom_components/places/directory in this repository - Place the files you downloaded in the new directory you created
- Restart Home Assistant
- See Configuration below
Using your HA configuration directory as a starting point you should now also have this:
custom_components/places/__init__.py
custom_components/places/config_flow.py
custom_components/places/const.py
custom_components/places/manifest.json
custom_components/places/sensor.py
custom_components/places/strings.json
custom_components/places/translations
custom_components/places/translations/en.json
</details>
Configuration
Configuration is done in the Integrations section of Home Assistant.
- Click Here to directly add a
placessensor or<br/> a. In Home Assistant, go to Settings -> Integrations<br/> b. Click+ Add Integrationsand selectplaces<br/> - Add your configuration (see Configuration Options below)
- Click
Submit
- Repeat as needed to create additional
placessensors - Options can be changed for existing
placessensors in Home Assistant Integrations by selectingConfigureunder the desiredplacessensor.
Configuration Options
Key | Required | Default | Description |
-- | -- | -- | --
Sensor Name | Yes | | Friendly name of the places sensor
Tracked Entity ID | Yes | | The location entity to track. Must have latitude and longitude as attributes. Supports these entities: device_tracker, person, sensor, variable & zone
Email Address | No | | OpenStreetMap API key (your email address).
Display Options | No | zone_name, place | Display options: formatted_place (exclusive option), driving (can be used with formatted_place or other options), zone or zone_name, place, place_name, street_number, street, city, county, state, postal_code, country, formatted_address, do_not_show_not_home<br /><br />See optional Advanced Display Options below to use more complex display logic.
Home Zone | No | zone.home | Used to calculate distance from home and direction of travel
Map Provider | No | apple | google, apple, osm
Map Zoom | No | 18 | Level of zoom for the generated map link <1-20>
Language | No |location's local language | Requested<sup>*</sup> language(s) for state and attributes. Two-Letter language code(s), separated by commas.<br /><sup>*</sup>Refer to Notes
Use GPS Accuracy | No | True | Use GPS Accuracy when determining whether to update the places sensor (if 0, don't update the places sensor). By not updating when GPS Accuracy is 0, should prevent inaccurate locations from being set in the places sensors.<br /><br />Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct.
Extended Attributes | No | False | Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!
Show Last Updated | No | False | Show last updated time at end of state (since xx:yy)
To use, simply enter your advanced options into the display_options text area. Any display_options that contain [] or () will be processed with the Advanced Display Options.<br />
Tip: Build your advanced display options string in a text editor and copy/paste it into display_options field as it is pretty small.
Brackets [ ]: Fields to show if initial field is blank or empty<br />
These can be nested.
Examples
name[type]will show the name, but if name is blank, will show the type instead. If type is also blank, nothing will show for that fieldname[type[category]]will show the name, but if name is blank, will show the type instead, but if type is blank, will show the category. If category is also blank, nothing will show for that field.
Parenthesis ( ): Inclusion/Exclusion Logic to filter the field<br />
To include/exclude based on the main field
-
Include: Set the first item inside the parenthesis to + to only show the field if it equals one of the states listed
-
Exclude: Set the first item inside the parenthesis to - to only show the field if doesn't equal one of the states listed
-
If + or - isn't listed as the first item inside the parenthesis, include(+) is assumed.
Examples
type(-, house)will show type if it is anything but "house"type(+, house)will show type only if it is "house"type(house)same astype(+, house)type(-, house, retail)will show type if it is anything but "house" or "retail"type(+, house, retail)will show type only if it is "house" or "retail"
To include/exclude based on other fields
-
Include: List the field to test followed by another set of parenthesis. In there, set the first item inside the parenthesis to + to only show the main field if the field to be tested equals one of the states listed
-
Exclude: List the field to test followed by another set of parenthesis. In there, set the first item inside the parenthesis to - to only show the main field if the field to be tested doesn't equal one of the states listed
-
As above, if + or - isn't listed as the first item inside the parenthesis, include(+) is assumed.
Examples
type(category(-, highway))will show type if category is anything but "highway"type(category(+, highway))will show type only if category is "highway"type(category(highway))same astype(category(+, highway))type(category(-, highway, building))will show type if category is anything but "highway" or "building"type(category(+, highway, building))will show type only if category is "highway" or "building"
The two types of include/excludes can also be combined
type(-,motorway, category(-, highway, building))will show type if it is not "motorway" and if category is not "highway" or "building"
Brackets and Parenthesis can also be combined
- To recreate
place:
name_no_dupe, category(-, place), type(-, yes), neighborhood, house_number, street
- To recreate
formatted_place:
zone_name[driving, name_no_dupe[type(-, unclassified, category(-, highway))[category(-, highway)], house_number, route_number(type(+, motorway, trunk))[street[route_number]], neighborhood(type(house))], city_clean[county], state_abbr]
Fields
drivingname(Synonym:place_name)name_no_dupe(Synonym:place_name_no_dupe)- Will be blank if the name is the same as one of the other attributes
type(Synonym:place_type)category(Synonym:place_category)street_number(Synonym:house_number)streetroute_number(Synonym:street_ref)neighborhood(Synonyms:neighbourhood,place_neighborhood,place_neighbourhood)citycity_cleancitybut removes "Township" and moves "City" to the end if it starts with "City of"
postal_town(Synonyms:borough,suburb)state(Synonym:region)state_abbrcountycountrycountry_codezip_code(Synonym:postal_code)latitudelongitudezonezone_name
Note: place and formatted_place are not valid fields in the advanced display options. See examples above for how to recreate them.
</details> <details> <summary>Sample attributes that can be used in notifications, alerts, automations, etc.</summary>
{
"formatted_address": "Richmond Hill GO Station, 6, Newkirk Road, Beverley Acres, Richmond Hill, York Region, Ontario, L4C 1B3, Canada",
"friendly_name": "sharon",
"current_latitude": "43.874149009154095",
"distance_from_home_km": 7.24,
"country": "Canada",
"postal_code": "L4C 1B3",
"direction_of_travel": "towards home",
"neighbourhood": "Beverley Acres",
"entity_picture": "/local/sharon.png",
