From 2103bfc8244f5de113060500f167315e6e89644d Mon Sep 17 00:00:00 2001 From: Jose Juan Montes Date: Sun, 12 Feb 2017 20:03:53 +0100 Subject: [PATCH] Fixed proximity zone incorrectly using name instead of zone setting. (#5862) * Fixed proximity zone incorrectly using name instead of zone setting. * Fixed proximity tests to suit change. --- homeassistant/components/proximity.py | 2 +- tests/components/test_proximity.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/proximity.py b/homeassistant/components/proximity.py index 73e72149b37..18548dc203b 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, diff --git a/tests/components/test_proximity.py b/tests/components/test_proximity.py index 1a1033ab31d..532a5e10ab4 100644 --- a/tests/components/test_proximity.py +++ b/tests/components/test_proximity.py @@ -394,6 +394,7 @@ class TestProximity(unittest.TestCase): 'device_tracker.test2' ], 'tolerance': '1', + 'zone': 'home' } } }) @@ -445,7 +446,9 @@ class TestProximity(unittest.TestCase): 'devices': [ 'device_tracker.test1', 'device_tracker.test2' - ] + ], + 'zone': 'home' + } } }) @@ -497,7 +500,8 @@ class TestProximity(unittest.TestCase): 'devices': [ 'device_tracker.test1', 'device_tracker.test2' - ] + ], + 'zone': 'home' } } }) @@ -538,7 +542,8 @@ class TestProximity(unittest.TestCase): 'devices': [ 'device_tracker.test1', 'device_tracker.test2' - ] + ], + 'zone': 'home' } } }) @@ -601,7 +606,8 @@ class TestProximity(unittest.TestCase): 'devices': [ 'device_tracker.test1' ], - 'tolerance': 1000 + 'tolerance': 1000, + 'zone': 'home' } } }) @@ -654,7 +660,8 @@ class TestProximity(unittest.TestCase): 'devices': [ 'device_tracker.test1', 'device_tracker.test2' - ] + ], + 'zone': 'home' } } })