Proximity with multiple users

In the proximity control there is an option for user(s). in order for the state to be true, do all users in the list have to be within the range of the zone specified, or will it flag when any of the users in the list are in the specified zone?

I believe it’s any, but the best way to know for sure is to test it!

I’m trying to setup proximity information for my wife and I individually so I can tell how far each of us is away from home. I have my configuration.yaml setup as follows.

proximity:
  me_home:
    zone: zone.home
    devices:
      device_tracker.me_keys
    tolerance: 5
    unit_of_measurement: mi
  wife_home:
    zone: zone.home
    devices:
      device_tracker.wife_keys
    tolerance: 5
    unit_of_measurement: mi

The HA proximity group shows both devices but shows “not set mi” as the status and the following error is in the HA.log file.

16-12-23 11:37:16 homeassistant.core: Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/components/proximity.py", line 138, in check_proximity_state_change
    proximity_latitude = zone_state.attributes.get('latitude')
AttributeError: 'NoneType' object has no attribute 'attributes'
16-12-23 11:37:16 homeassistant.core: Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/components/proximity.py", line 138, in check_proximity_state_change
    proximity_latitude = zone_state.attributes.get('latitude')
AttributeError: 'NoneType' object has no attribute 'attributes'

Hi I am also hitting this.

I think I found the bug. I am testing this which seems to work, will submit a PR if it works ok.

Issue seems to be that the zone name was being taken from the name, instead of from the ‘zone’ configuration option.

diff --git a/homeassistant/components/proximity.py b/homeassistant/components/proximity.py
index 73e7214..18548dc 100644
--- a/homeassistant/components/proximity.py
+++ b/homeassistant/components/proximity.py
@@ -63,7 +63,7 @@ def setup_proximity_component(hass, name, config):
     proximity_zone = name
     unit_of_measurement = config.get(
         CONF_UNIT_OF_MEASUREMENT, hass.config.units.length_unit)
-    zone_id = 'zone.{}'.format(proximity_zone)
+    zone_id = 'zone.{}'.format(config.get(CONF_ZONE))
 
     proximity = Proximity(hass, proximity_zone, DEFAULT_DIST_TO_ZONE,
                           DEFAULT_DIR_OF_TRAVEL, DEFAULT_NEAREST,

Same here. I ended up using state, but want to go back to zone if @jjmontesl 's fix works.

Sent pull request: https://github.com/home-assistant/home-assistant/pull/5862

1 Like

@turboc

proximity:
  me_home:
    zone: zone.home
    devices:
      device_tracker.me_keys
    tolerance: 5
    unit_of_measurement: mi
  wife_home:
    zone: zone.home
    devices:
      device_tracker.wife_keys
    tolerance: 5
    unit_of_measurement: mi

that configuration is correct? its working?

Use just the plain zone name (home) instead of the full name (zone.home).

Otherwise, that should work - it’s pretty much what I use.

1 Like

thanks friend.

Was this ever resolved? I’m getting:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57 in
result = self.fn*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassitant/components/proximity/ **init** .py”, line 192, in check_proximity_state_change
if device_state.state in self.ignored_zones:
AttributeError: ‘NoneType’ object has no attribute ‘state’