Keep getting proximity configuration warnings

Hi

I’ve been struggling with proximity configuration and I’m trying to get it not warn about configuration. As long as I can tell my proximity configuration is setup by the book like this

proximity:
  - zone: home
    ignored_zones:
      - itleverantoren
    devices:
      - device_tracker.peter_oneplus2
      - device_tracker.karin_xperiaz5c
    tolerance: 50
    unit_of_measurement: km
  - zone: itleverantoren
    ignored_zones:
      - home
    devices:
      - device_tracker.peter_oneplus2
    tolerance: 50
    unit_of_measurement: km

However I keep getting warnings in console like this one down here, and also as of later daily updates there’s a box in the ui telling me there’s something wrong with the proximity configuration, I just can’t figure out what it is.

ERROR (Thread-1) [homeassistant.bootstrap] The following platforms contain invalid configuration: proximity (please check your configuration)expected a dictionary for dictionary value @ data['proximity']. Got [OrderedDict([('zone', 'home'), ('ignored_zones', ['itleverantoren']), ('devices', ['device_tracker.peter_oneplus2', 'device_tracker.karin_xperiaz5c']), ('tolerance', 50), ('unit_of_measurement', 'km')]), OrderedDict([('zone', 'itleverantoren'), ('ignored_zones', ['home']), ('devices', ['device_tracker.peter_oneplus2']), ('tolerance', 50), ('unit_of_measurement', 'km')])].

Help is much appreciated if you have any insight into this.

Best regards
Peter

Please post config snippets in code tags so spacing is preserved. Not doing so makes it very hard to debug.

Peter - highlight your code and then hit the code format button as opposed to the quote button. It looks like this:

Thanks, I’ve updated my post using code format so now you can see the spacings and all. Have I missed some formating in the code maybe?

Hi @pitrus,
The proximity component doesn’t allow you to have several configs in that way.
You might want to try this config:

proximity:
  zone: home
  ignored_zones:
    - itleverantoren
  devices:
    - device_tracker.peter_oneplus2
    - device_tracker.karin_xperiaz5c
  tolerance: 50
  unit_of_measurement: km

proximity 2:
  zone: itleverantoren
  ignored_zones:
    - home
  devices:
    - device_tracker.peter_oneplus2
  tolerance: 50
  unit_of_measurement: km

if that’s not helping, you might to take a look at this file I created a while ago: https://github.com/nickwaring/home-assistant/blob/519a5cf92bb65e17f07e8cb0e1694d8634adad35/homeassistant/components/proximity.py

this allows you to have multiple zones as targets for the proximity component and it allows you to reverse the logic so you would see which zone is closest to a given device

2 Likes