custom-components / places Goto Github PK
View Code? Open in Web Editor NEWComponent to integrate with OpenStreetMap Reverse Geocode (places)
License: GNU General Public License v3.0
Component to integrate with OpenStreetMap Reverse Geocode (places)
License: GNU General Public License v3.0
The option to remove state_province
and state_abbr
from formatted_place
and formatted_address
would be great as not necessary in my use case.
EDIT: Actually, it might be handy to have all the parts configurable whether they are included or not ?
EDIT2: Just noticed you can configure this in the integrations page, thought only the lists in the drop down box were the only options
After upgrading to the above versions I am getting the following errors from home assistant.
Reverting back to 1.12 solves the issue.
I have the following in my configuration
2022-09-21 18:41:05.920 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.places.sensor
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 681, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 698, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/places/sensor.py", line 131, in
discovery_info: DiscoveryInfoType | None = None,
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'
Hi i created the places folder within custom_components and added your 3 files, then put this into my configuration.yaml file but when i go to check configuration it just spins endlessly and i'm unable to restart.
Am i missing something ?
Thanks
Edit...
It works now, my fault I downloaded your 3 files by right clicking on their file names and saving and the files looked right but realised the text inside wasn't,
So downloaded by right click the raw box and I added it ok then.
Thanks
sensor places_steve:
- platform: places
name: steve
devicetracker_id: device_tracker.mi_a2_lite
options: zone,place
map_provider: google
map_zoom: 19
home_zone: zone.home
api_key: !secret email_steve
Updated to latest version yesterday.
I was on my way home at that time.
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: homeassistant
Source: custom_components/places/sensor.py:1145
Integration: Places (documentation, issues)
First occurred: 09:00:04 (13 occurrences)
Last logged: 09:05:25
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 640, in tsc_update
self.do_update("Track State Change")
File "/config/custom_components/places/sensor.py", line 1145, in do_update
osm_decoded = json.loads(osm_json_input)
File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-09-22 08:59:00 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform places.sensor: Platform not found (No module named 'homeassistant.helpers.issue_registry').
Add a new option to allow show / hode since ...
in sensor state
Since 4 weeks I have this error in the logs:
Logger: homeassistant
Source: custom_components/places/sensor.py:568
Integration: places (documentation)
First occurred: 9:00:43 (2 occurrences)
Last logged: 9:01:28
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 434, in tsc_update
self.do_update("Track State Change")
File "/config/custom_components/places/sensor.py", line 568, in do_update
osm_decoded = json.loads(osm_json_input)
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Latest version of HA as well as component.
Everything works for me, but the included map is not working.
I get the alerts, just the top of the alert says "Failed to load attachment, Unrecognized attachment file type"
automations.yaml
- alias: ReverseLocate
initial_state: 'on'
trigger:
platform: event
event_type: places_state_update
condition:
condition: template
value_template: '{{ trigger.event.data.entity == "Person" }}'
action:
- service: notify.mobile_app_iphone
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 }} from home and traveling {{ trigger.event.data.direction }}
{{ trigger.event.data.to_state }} ({{ trigger.event.data.mtime }})
data:
attachment:
url: '{{ trigger.event.data.map }}'
hide_thumbnail: false
configuaration.yaml
- platform: places
name: Person
devicetracker_id: device_tracker.person_iphone
options: place,zone
#display_zone: show
map_provider: google
map_zoom: 19
home_zone: zone.home
api_key: [email protected]
With latest version 1.5, it prevents homeassistant starting, this is in the log, several times. Reverted to v1.4 and it works fine
2019-11-20 09:41:07 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/__main__.py", line 302, in setup_and_run_hass
log_no_color=args.log_no_color,
File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 146, in async_from_config_file
config_dict, hass, enable_log=False, skip_pip=skip_pip
File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 91, in async_from_config_dict
await _async_set_up_integrations(hass, config)
File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 372, in _async_set_up_integrations
*(async_setup_component(hass, domain, config) for domain in domains_to_load)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/helpers/discovery.py", line 151, in async_load_platform
setup_success = await setup.async_setup_component(hass, component, hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/helpers/discovery.py", line 151, in async_load_platform
setup_success = await setup.async_setup_component(hass, component, hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 562, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/helpers/discovery.py", line 151, in async_load_platform
setup_success = await setup.async_setup_component(hass, component, hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/setup.py", line 51, in async_setup_component
return await task # type: ignore
File "/usr/src/homeassistant/homeassistant/setup.py", line 147, in _async_setup_component
hass, config, integration
File "/usr/src/homeassistant/homeassistant/config.py", line 755, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 232, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/places/sensor.py", line 435
def haversine(lon1, lat1, lon2, lat2):
^
TabError: inconsistent use of tabs and spaces in indentation
It looks like there's a device update that occurs before HA is fully initialized where self.hass is none. We may have to add a check or even wait to initialize updates until after the entity is added to HA.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 428, in tsc_update
self.do_update("Track State Change")
File "/config/custom_components/places/sensor.py", line 504, in do_update
devicetracker_zone = self.hass.states.get(self._devicetracker_id).state
AttributeError: 'NoneType' object has no attribute 'states'
I use this component and would like to keep using this component but I am concerned that it was blacklisted. The blacklist is here. If this is still being maintained please get it removed from the blacklist.
Is there anyway to get the 2 letter state abbreviation for locations that are in the US? It would make the address that I display a bit shorter if I could just show the 2 letter abbreviation.
Hello there, thank you for this integration.
I would like to use it, but i cannot figure out how to use all the parameters and how to activate ?
Maybe it would be nice to get a demo configuration.yaml to look at for further information ?
Greetings from Austria
Kilowatt :-)
I have set up two 'places' sensors, one is currently working although the location is 'Home' but the other which is not home is giving this error...
Options used:
options: do_not_reorder, place_name, street_number, street, city, postal_code
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 432, in update
self.do_update("Scan Interval")
File "/config/custom_components/sensor/places.py", line 676, in do_update
user_display.append(targetoption)
NameError: name 'targetoption' is not defined
This error appears sometimes, when I'm at home, but floods my logfile, when I'm outside
v2.0.4 HA 2022.8.6
Logger: homeassistant
Source: custom_components/places/sensor.py:1342
Integration: Places (documentation, issues)
First occurred: 16:38:06 (148 occurrences)
Last logged: 17:03:30
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 640, in tsc_update
self.do_update("Track State Change")
File "/config/custom_components/places/sensor.py", line 1342, in do_update
self._place_type.lower() == "house"
AttributeError: 'NoneType' object has no attribute 'lower'
It looks like you can change the Apple Maps link to include a pin.
Instead of using ll, I believe you can use q to make a pin appear.
So:
https://maps.apple.com/maps/?ll=38.889455,-77.035218&z=18
Becomes:
https://maps.apple.com/maps/?q=38.889455,-77.035218&z=18
Will it be possible to use person entity instead of device tracker? I am using both life360 and HA app for location tracking which is combined with person domain but i not able to make this integration work with person.
No option for a "scan_interval" in UI settings.
If "scan_interval" does not work anymore - please let us know.
Prior to upgrade, sensors working OK. Post-upgrade, sensor states for defined Places sensors all stuck at "Initializing..."
Sensor configuration:
- platform: places
name: <redact>
devicetracker_id: device_tracker.life360_<redact>
options: street,city
map_provider: google
map_zoom: 18
home_zone: zone.home
api_key: !secret email_address
Component manifest:
{
"domain": "places",
"name": "Places",
"version":"1.9",
"documentation": "https://github.com/custom_components/places",
"dependencies": ["device_tracker"],
"codeowners": ["@tenly2000","@iantrich"],
"requirements": []
}
Turned on debug logging for this component, but nothing logged related to this component other than an initial line in the logs:
2022-07-08 12:39:08 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration places which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
Rolled HA Core back to 2022.6.7 and sensors reporting ok again. Suspect Python 3.10 update (introduced in 2022.7.x) to be the root cause, despite no errors indicating this.
Can anybody confirm if this places plugin still works?
I've put a few hours into it, but unable to get it working :-(
Why does this component say House 123 Fake St. or Building 123 Fake St. when it should just say 123 Fake St.
First off, thank you for this great integration that I use every day!
Any chance you could update it to include the version key in the manifest, as per this recent message from HA:
No 'version' key in the manifest file for custom integration 'places'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'places'.
Thank you.
After every HA restart have UnboundLocalError: local variable 'current_location' referenced before assignment
Logger: homeassistant.helpers.entity
Source: custom_components/places/sensor.py:518
Integration: places (documentation)
First occurred: 18:17:21 (1 occurrences)
Last logged: 18:17:21
Update for sensor.inna fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 514, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 709, in async_device_update
raise exc
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 192, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/places/sensor.py", line 439, in update
self.do_update("Scan Interval")
File "/config/custom_components/places/sensor.py", line 518, in do_update
if current_location == previous_location:
UnboundLocalError: local variable 'current_location' referenced before assignment
Home Assistant 2022.8.5
Supervisor 2022.08.3
Operating System 8.4
Frontend 20220802.0 - latest
This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'places'
Is this something that will be sorted because I love your plugin.
The integration is moved to UI.
Once loaded, you need to remove the places sensors from your configuration.yaml
So you left no choice for users and they now cannot use the integration as a package which can commented, moved to another HA instance, copied to another HA instance?
And please do not say that developers HAVE NO OTHER CHOICE.
At least you can support a "yaml settings keep read from yaml, Ui settings edit in UI" if you want using UI so much.
Check some other integrations: if settings are imported from yaml - they are read-only; only UI-entered settings are available for changing in UI.
Great, now I need to repeat same api_key, same settings an several places - instead of defining them in ONE place and then using an anchor.
Cannot use my email as a secret.
Cannot use a source sensor for some entry (devicetracker_id) which is a sensor
- instead I am obliged to use person
& device_tracker
.
Cannot specify a scan_interval
.
Also, using UI is supposed to be convenient for users.
But scrolling this screen is kind of typing SMS on Ericcson T28:
This is not a progress. You are following a bad trend.
HA Version information:
Home Assistant 2022.9.0
Supervisor 2022.09.1
Operating System 8.5
Frontend 20220907.0 - latest
My config in configuration.yaml
sensor places_xxxxxxx:
- platform: places #ignore the bullet symbol... this is a dash in my config
name: xxxxxx_locatie
devicetracker_id: device_tracker.iphonexxxxxx
#options: street, street_number, city
map_provider: google
map_zoom: 19
home_zone: zone.home
api_key: '[email protected]'
I did not had this behavior in 2 versions earlier.
Did I do something wrong? What can I do to fix this? Maybe this is caused by a misconfiguration from my side, I'm relatively new to HA.
Thanks for this nice plugin and the energy you stick in this free module!
Part of the error in logging:
Logger: homeassistant
Source: custom_components/places/sensor.py:993
Integration: Places: OpenStreetMap Sensor (documentation, issues)
First occurred: 22:57:38 (6 occurrences)
Last logged: 23:05:45Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network unreachableDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fedb9cadff0>: Failed to establish a new connection: [Errno 101] Network unreachableDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /reverse?format=jsonv2&lat=52.58351869210295&lon=5.931531429159805&accept-language=nl&addressdetails=1&namedetails=1&zoom=18&limit=1&email=[email protected] (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fedb9cadff0>: Failed to establish a new connection: [Errno 101] Network unreachable'))During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 548, in tsc_update
self.do_update("Track State Change")
File "/config/custom_components/places/sensor.py", line 993, in do_update
osm_response = requests.get(osm_url)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /reverse?format=jsonv2&lat=52.58351869210295&lon=5.931531429159805&accept-language=nl&addressdetails=1&namedetails=1&zoom=18&limit=1&email=[email protected] (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fedb9cadff0>: Failed to establish a new connection: [Errno 101] Network unreachable'))
After updating to 2.0 the log is flooded by errors:
2022-09-20 06:31:21.664 ERROR (MainThread) [homeassistant.components.sensor] places: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 703, in async_device_update
await task
File "/config/custom_components/places/sensor.py", line 485, in async_update
await self._hass.async_add_executor_job(self.do_update, "Scan Interval")
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 626, in do_update
current_location = new_latitude + "," + new_longitude
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
2022-09-20 06:32:52.865 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/places/sensor.py", line 468, in tsc_update
self.do_update("Track State Change")
File "/config/custom_components/places/sensor.py", line 626, in do_update
current_location = new_latitude + "," + new_longitude
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
City shows a dash even though formatted_address shows the city:
current_latitude: 40.136444091796875
current_longitude: -111.60757320395898
street_number: 2391
street: 225 East
**city: -**
postal_town: -
postal_code: 84663
state_province: Utah
country: United States
county: Utah County
formatted_address: 2391, 225 East, **Springville**, Utah County, Utah, 84663, United States
place_type: -
In the debug log, osm response contains an attribute of ["address"]["town"]
instead of ["address"]["city"]
.
My workaround is:
Current Version: 1.2 20180510 - Jim Thompson
if "city" in osm_decoded["address"]:
city = osm_decoded["address"]["city"]
else:
if "town" in osm_decoded["address"]:
city = osm_decoded["address"]["town"]
Hello,
Neighbourhood display option doesn't work, when I look at the attributes I have the correct neighbourhood, but when i choose to display it with display_options "neighborhood", it shows "Unknown" on my card.
Log displays :
2022-12-23 23:07:59.964 WARNING (SyncWorker_2) [custom_components.places.sensor] (localisation_xxxx) New State is None
just update to hassio 0.92, and the component stops working, add the manifiest.json but it its not working anymore
Have this issue on startup, can get round it by commenting out all refs to entity-picture in sensor.py
Error while setting up platform places
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, 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 312, 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 332, in __init__
self._entity_picture = hass.states.get(devicetracker_id).attributes.get('entity_picture')
AttributeError: 'NoneType' object has no attribute 'attributes'
Maybe related to this closed issue:
I have been trying to figure out if there is a way to change the settings to show distance and speed in imperial instead of metric units? Is this possible? Thanks!
New version doesn't support scan_interval configuration via UI
distance_m = distance(float(new_latitude), float(new_longitude), float(home_latitude), float(home_longitude))
ValueError: could not convert string to float: 'None'
Someone has this error also ?
I have the KIA/HYUNDAI custom integration installed and the device_tracker
constantly has a GPS accuracy of 0 so will not allow PLACES to work for that device_tracker
. Could we add an option, per PLACES integration, to allow for this please as noted in the latest changelog ?
Add GPS accuracy as attribute and only update the sensor if GPS accuracy is >0 if it exists in #108
If there are devicetracker_ids that work but have GPS Accuracy as 0, this could become an option.
2.0.5
These errors are observed on HA startup for each sensor:
2022-09-29 21:24:46.561 ERROR (SyncWorker_5) [custom_components.places.sensor] (place_iphone_6s_plus) Problem with updated lat/long, this update will likely fail: new_latitude=None, new_longitude=None, home_latitude=censored, home_longitude=censored
Also, the log is full of these warnings:
2022-09-29 22:00:07.891 WARNING (SyncWorker_16) [custom_components.places.sensor] (place_iphone_6) Timeout connecting to OpenStreetMaps [Error: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Read timed out. (read timeout=None)]: https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=*censored*&lon=*censored*&addressdetails=1&namedetails=1&zoom=18&limit=1&email=*censored*
Often times the max length of 255 characters is exceeded for me
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.martin. State max length is 255 characters.
2020-01-30 12:55:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 405, in _async_write_ha_state
self.entity_id, state, attr, self.force_update, self._context
File "/usr/src/homeassistant/homeassistant/core.py", line 977, in async_set
state = State(entity_id, new_state, attributes, last_changed, None, context)
File "/usr/src/homeassistant/homeassistant/core.py", line 721, in __init__
f"Invalid state encountered for entity id: {entity_id}. "
I have set the following options:
zone,place,street_number,street,city,state,postal_code, county, country
I have removed a couple to get rid of the issue is there a better way tofix this?
Finding a problem, more than 200 kilometers of travel, places would stop working。
The usage limit may have been exceeded
After upgrading to version 2021.12.x I am getting the following error messages
Entity sensor.angela_places (<class 'custom_components.places.sensor.Places'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.nicolas_places (<class 'custom_components.places.sensor.Places'>) implements device_state_attributes. Please report it to the custom component author.
If I am not mistaken in that version something is changed regarding device_state_attributes
Example entity:
https://www.openstreetmap.org/way/183931658
https://nominatim.openstreetmap.org/ui/details.html?osmtype=W&osmid=183931658&class=shop
Wikidata: Though not always present; this lets further queries be executed against other APIs.
IE:
This would allow (seperate) sensors like: "X has entity Y, run query to determine architect from wikidata" or similar attributes which are not in OSM.
Here was my code in yaml:
- platform: places
name: place_ipad_air_2
devicetracker_id: sensor.tracker_common_ipad_air_2
home_zone: zone.home
api_key: *******************************
options: formatted_address
map_provider: google
map_zoom: 19
scan_interval: 60
Because of unknown reasons the "devicetracker_id" was replaced with other value.
Here are UI settings:
Here for "Device tracker ID" a friendly_name is displayed - a confusing functionality repeated in many HA UI fields.
Let's tap on on it - otherwise it is impossible to guess what the values it is:
Why this value was set??? This is not my setting.
This is great stuff you are sharing. I got it working easily. Though the struggle is real in regards to templating out some attributes out of the original sensor.
I did read the article below, though i still did not manage to get it working.
https://www.home-assistant.io/docs/configuration/templating/
Not sure if that is a json template that i should use, if yes how :/
All im trying to do is create a template sensor that will only have street &/or postal_code. So i can then + it into a lovelace card.
I realize this is more about templating in HomeAssistant rather this custom component though i believe other folks will have the same struggle. So an example of a template or two in github would help a lot.
In any case thanks for this custom component ! this is great work !!
I have two places sensor entities. One for my phone works very well, but the other for my car doesn't. I don't get the city attribute for my car sensor. These are the attributes I get from BMW device tracker:
source_type: gps
latitude: 52.500000
longitude: 13.000000
gps_accuracy: 0
car: i3
vin: XXXXXXXXXX
direction: XXX
attribution: Data provided by MyBMW
icon: mdi:car
friendly_name: i3
Places attributes:
devicetracker_entityid: device_tracker.i3
home_zone: zone.home
distance_from_home_km: 0
distance_from_home_m: 0
last_changed: '2022-10-12 08:06:36.482760'
home_latitude: '52.000000'
home_longitude: '12.800000'
direction_of_travel: stationary
options: zone, place
friendly_name: i3 location
Note: I changed the values for latitude and longitude randomly. These are not my real values.
hello I was using this feature to track as well as via telegram message which also works very well on the google map which hasn't worked for some time. I explain myself better when I go to attributes to locate the car hours I no longer see the map but only latitude and longitude in terms of values instead before the google map opened I would not want all these changes and new home assistant releases to have spoiled something to the places functionality
I occasionally see this error in my logs. I presume wherever I am is too wordy and exceeding the 255 character limit of the sensor state. Probably just want to add '[:255]' to the end of the string when setting the state. Will look into submitting a PR.
2022-07-14 16:43:06 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 762, in _update_entity_states
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 646, in _async_write_ha_state
self.hass.states.async_set(
File "/usr/src/homeassistant/homeassistant/core.py", line 1438, in async_set
state = State(
File "/usr/src/homeassistant/homeassistant/core.py", line 1099, in __init__
raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.snuffy2s_place. State max length is 255 characters.
Valid in general, but need in particular for non English languages where users might need to set friendly_name
to turn the default Home
zone, into something else.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.