• Stars
    star
    110
  • Rank 314,861 (Top 7 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 6 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Component to integrate with OpenStreetMap Reverse Geocode (places)

places

places Logo

GitHub Release GitHub Release Date GitHub Commit Activity GitHub last commit License
HACS GitHub Workflow Status
Community Forum

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)

  1. Ensure that HACS is installed
  2. Click Here to directly open places in HACS or
      a. Navigate to HACS
      b. Click + Explore & Download Repositories
      c. Find the places integration
  3. Click Download
  4. Restart Home Assistant
  5. See Configuration below

Manual

You probably do not 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

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml)
  2. If you do not have a custom_components directory there, you need to create it
  3. In the custom_components directory create a new folder called places
  4. Download all the files from the custom_components/places/ directory in this repository
  5. Place the files you downloaded in the new directory you created
  6. Restart Home Assistant
  7. 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

Configuration

Configuration is done in the Integrations section of Home Assistant. Configuration with configuration.yaml is no longer supported.

  1. Click Here to directly add a places sensor or
      a. In Home Assistant, go to Settings -> Integrations
      b. Click + Add Integrations and select places
  2. Add your configuration (see Configuration Options below)
  3. Click Submit
  • Repeat as needed to create additional places sensors
  • Options can be changed for existing places sensors in Home Assistant Integrations by selecting Configure under the desired places sensor.

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

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* language(s) for state and attributes. Two-Letter language code(s), separated by commas.
*Refer to Notes
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)
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 updaing when GPS Accuracy is 0, should prevent inaccurate locations from being set in the places sensors.

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.

Advanced Display Options

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.
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

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 field
  • name[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

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 as type(+, 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 as type(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

  • driving
  • name (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)
  • street
  • route_number (Synonym: street_ref)
  • neighborhood (Synonyms: neighbourhood, place_neighborhood, place_neighbourhood)
  • city
  • city_clean
    • city but removes "Township" and moves "City" to the end if it starts with "City of"
  • postal_town
  • state (Synonym: region)
  • state_abbr
  • county
  • country
  • country_code
  • zip_code (Synonym: postal_code)
  • latitude
  • longitude
  • zone
  • zone_name

Note: place and formatted_place are not valid fields in the advanced display options. See examples above for how to recreate them.


Sample attributes that can be used in notifications, alerts, automations, etc.
{
  "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",
  "street_number": "6",
  "devicetracker_entityid": "device_tracker.sharon_iphone7",
  "home_longitude": "-79.7323453871",
  "devicetracker_zone": "not_home",
  "distance_from_home_m": 17239.053,
  "home_latitude": "43.983234888",
  "previous_location": "43.86684124904056,-79.4253896502715",
  "previous_longitude": "-79.4253896502715",
  "place_category": "building",
  "map_link": "https://maps.apple.com/maps/?ll=43.874149009154095,-79.42642783709209&z=18",
  "last_changed": "2018-05-02 13:44:51.019837",
  "state_province": "Ontario",
  "county": "York Region",
  "current_longitude": "-79.42642783709209",
  "current_location": "43.874149009154095,-79.42642783709209",
  "place_type": "building",
  "previous_latitude": "43.86684124904056",
  "place_name": "Richmond Hill GO Station",
  "street": "Newkirk Road",
  "city": "Richmond Hill",
  "home_zone": "zone.sharon_home"
}
Sample generic `automations.yaml` snippet to send an iOS notify on any device state change

(the only difference is the second one uses a condition to only trigger for a specific user)

- alias: ReverseLocateEveryone
  initial_state: 'on'
  trigger:
    platform: event
    event_type: places_state_update
  action:
  - service: notify.ios_jim_iphone8
    data_template:
      title: 'ReverseLocate: {{ trigger.event.data.entity }} ({{ trigger.event.data.devicetracker_zone }}) {{ trigger.event.data.place_name }}'
      message: |-
        {{ trigger.event.data.entity }} ({{ trigger.event.data.devicetracker_zone }})
        {{ trigger.event.data.place_name }}
        {{ trigger.event.data.distance_from_home_km }} km from home and traveling {{ trigger.event.data.direction_of_travel }}
        {{ trigger.event.data.to_state }} ({{ trigger.event.data.last_changed }})
      data:
        attachment:
          url: '{{ trigger.event.data.map_link }}'
          hide_thumbnail: false

- alias: ReverseLocateAidan
  initial_state: 'on'
  trigger:
    platform: event
    event_type: places_state_update
  condition:
    condition: template
    value_template: '{{ trigger.event.data.entity == "aidan" }}'
  action:
  - service: notify.ios_jim_iphone8
    data_template:
      title: 'ReverseLocate: {{ trigger.event.data.entity }} ({{ trigger.event.data.devicetracker_zone }}) {{ trigger.event.data.place_name }}'
      message: |-
        {{ trigger.event.data.entity }} ({{ trigger.event.data.devicetracker_zone }})
        {{ trigger.event.data.place_name }}
        {{ trigger.event.data.distance_from_home_km }} km from home and traveling {{ trigger.event.data.direction_of_travel }}
        {{ trigger.event.data.to_state }} ({{ trigger.event.data.last_changed }})
      data:
        attachment:
          url: '{{ trigger.event.data.map_link }}'
          hide_thumbnail: false

Notes

  • This component is only useful to those who have device tracking enabled via a mechanism that provides latitude and longitude coordinates (such as the Home Assistant Mobile App, OwnTracks, or iCloud3).
  • The OpenStreetMap database is very flexible with regards to tag_names in their database schema. If you come across a set of coordinates that do not parse properly, you can enable debug logging (see below) to see the actual JSON that is returned from the query.
  • The OpenStreetMap API requests that you include your valid e-mail address in each API call if you are making a large numbers of requests. They say that this information will be kept confidential and only used to contact you in the event of a problem, see their Usage Policy for more details.
  • The map link that gets generated for Google, Apple or OpenStreetMaps has a push pin marking the users location. Note that when opening the Apple link on a non-Apple device, it will open in Google Maps.
  • When no language value is given, default language will be in the location's local language. When a comma separated list of languages is provided - the component will attempt to fill each address field in desired languages by order.
  • Translations are partial in OpenStreetMap database. For each field, if a translation is missing in first requested language it will be resolved with a language following in the provided list, defaulting to local language if no matching translations were found for the list.
  • To enable debug logging for this component, add the following to your configuration.yaml file
logger:
  default: warning
  logs:
    custom_components.places: debug  

Prior Contributions:

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines


More Repositories

1

ble_monitor

BLE monitor for passive BLE sensors
Python
1,875
star
2

remote_homeassistant

Links multiple home-assistant instances together
Python
884
star
3

pyscript

Pyscript adds rich Python scripting to HASS
Python
851
star
4

nordpool

This component allows you to pull in the energy prices into Home-Assistant.
Python
443
star
5

custom_updater

[DEPRECATED]📦 A component which allows you to track and update custom cards/components and python_scripts
Python
166
star
6

grocy

Custom Grocy integration for Home Assistant
Python
156
star
7

feedparser

📰 RSS Feed Integration
Python
134
star
8

sensor.unifigateway

High level health status of UniFi Security Gateway devices via UniFi Controller
Python
127
star
9

weatheralerts

A sensor that gives you weather alerts from alerts.weather.gov.
Python
125
star
10

climate.programmable_thermostat

Programmable thermostat that let you have a smart thermostat on budget.
Python
113
star
11

media_player.braviatv_psk

Sony Bravia TV (Pre-Shared Key) component for Home Assistant
Python
106
star
12

sensor.rpi_power

A Custom component for Home-Assistant that checks if your Raspberry Pi power supply is giving enough voltage from the kernel.
Python
103
star
13

sensor.airthings_wave

hassio support for Airthings Wave BLE environmental radon sensor.
Python
100
star
14

sensor.plex_recently_added

▶️ Plex component to feed Upcoming Media Card.
Python
82
star
15

authenticated

A platform which allows you to get information about sucessfull logins to Home Assistant.
Python
82
star
16

breaking_changes

Component to show potential breaking_changes in the current published version based on your loaded components
Python
81
star
17

zaptec

zaptec charger custom component for home assistant
Python
63
star
18

sensor.trakt

📺 Trakt Integration for Upcoming Media Card
Python
60
star
19

sensor.radarr_upcoming_media

🎬 Radarr component to feed Upcoming Media Card.
Python
57
star
20

youtube

A platform which give you info about the newest video on a channel
Python
55
star
21

sensor.sonarr_upcoming_media

📺 Sonarr component to feed Upcoming Media Card.
Python
53
star
22

healthchecksio

Update and display the status of your healthchecks.io checks.
Python
51
star
23

sensor.avanza_stock

Custom component to get stock data from Avanza for Home Assistant
Python
46
star
24

sensor.ssh

SSH Generic Sensor
Python
43
star
25

sensor.untappd

🍻 Untappd Integration
Python
36
star
26

readme

Use Jinja and data from Home Assistant to generate your README.md file
Python
33
star
27

information

📜 Information about this organization
31
star
28

sensor.stadtreinigung_hamburg

Stadtreinigung Hamburg - get garbage collection dates in Hamburg - custom component for Home Assistant
Python
25
star
29

sensor.yandex_maps

A platform which give you the time it will take to drive.
Python
25
star
30

combined

A camera platform that give you a combined feed of your defined camera entities.
Python
24
star
31

wienerlinien

A sensor that give you information about next departure from spesified stop.
Python
21
star
32

templatesensor

Add template sensors from the UI.
Python
19
star
33

uilogs

DEPRECATED: Custom panel that show colorful logs for Home Assistant (core), and the supervisor (if you have it).
TypeScript
18
star
34

sensor.nintendo_wishlist

A sensor that monitors a Nintendo Switch wish list for when games are on sale.
Python
17
star
35

sensor.personalcapital

💵 Personal Capital Integration for Bank Account Monitoring
Python
15
star
36

switch.hadockermon

A switch platform that interact with ha-dockermon.
Python
14
star
37

unsplash

A camera platform that give you random images from Unsplash presented as a camera feed.
Python
13
star
38

gpodder

🎧 gPodder Integration for Podcast Feed Monitoring
Python
13
star
39

sensor.owlintuition

A set of sensors to integrate the OWL Intuition devices network
Python
11
star
40

sensor.file_restore

Improved file sensor component that let you read the whole last line content.
Python
11
star
41

usps_mail

A component that give you to info about incoming letters and packages from USPS.
Python
9
star
42

sensor.custom_aftership

A component which allows you to get information about pending parcels.
Python
8
star
43

sensor.tautulli

A platform which allows you to get information from Tautulli.
Python
8
star
44

sensor.avfallsor

Simple sensor for avfallsor
Python
8
star
45

brewdog

🍻 Display information about random beers from Brewdog as a sensor in Home Assistant, you can use this in a push notification next time you visit a bar.
Python
7
star
46

sensor.kodi_recently_added

Kodi component to feed the Upcoming Media Card for Home Assistant.
Python
7
star
47

config_check

Run the CLI config_check from a service call.
Python
7
star
48

ups

The ups platform allows one to track deliveries by the UPS
Python
6
star
49

fedex

The fedex platform allows one to track deliveries by FedEx
Python
5
star
50

sensor.launchlibrary

Get info about next space launches
Python
4
star
51

climate.e_thermostaat

E-Thermostaat (ICY) component for Home Assistant
Python
3
star
52

custom_components

[archived] Use this instead: https://github.com/custom-components/custom_updater
Python
3
star
53

camera.multisource

A camera platform that generate a camera feed from multiple sources.
Python
2
star
54

srp_energy

The srp_energy integration shows information from Srp hourly energy usage report for their customers
Python
2
star
55

hassbian_config

A custom component which allows you to controll some hassbian-config functions from Home Assistant.
Python
2
star
56

sensor.ruter

A sensor platform that gives you information about next departures.
Python
2
star
57

lists

Python
2
star
58

sensor.wifi-scanner

A Wi-Fi scanner sensor
Python
2
star
59

sensor.versions

Deprecated.
Python
2
star
60

sensor.custom_cards

This sensor is no longer needed
Python
1
star
61

sytadin

The sytadin sensor platform allows you to monitor traffic details from Sytadin
Python
1
star
62

sickchill

Taps into Sickchill Api so you can perform basic commands
Python
1
star
63

complimentr

Component to integrate with complimentr.
Python
1
star
64

binary_sensor.hadockermon

A custom binary_sensor platform which allows you get sensor data from ha-dockermon.
Python
1
star