diff --git a/tests/components/demo/test_geo_location.py b/tests/components/demo/test_geo_location.py index acfc97b00e6..9cade83285f 100644 --- a/tests/components/demo/test_geo_location.py +++ b/tests/components/demo/test_geo_location.py @@ -45,18 +45,22 @@ class TestDemoPlatform(unittest.TestCase): all_states = self.hass.states.all() assert len(all_states) == NUMBER_OF_DEMO_DEVICES + 1 - # Check a single device's attributes. - state_first_entry = all_states[1] # 0 is zone - assert abs( - state_first_entry.attributes['latitude'] - - self.hass.config.latitude - ) < 1.0 - assert abs( - state_first_entry.attributes['longitude'] - - self.hass.config.longitude - ) < 1.0 - assert state_first_entry.attributes['unit_of_measurement'] == \ - DEFAULT_UNIT_OF_MEASUREMENT + for state in all_states: + # Check a single device's attributes. + if state.domain != geo_location.DOMAIN: + # ignore home zone state + continue + assert abs( + state.attributes['latitude'] - + self.hass.config.latitude + ) < 1.0 + assert abs( + state.attributes['longitude'] - + self.hass.config.longitude + ) < 1.0 + assert state.attributes['unit_of_measurement'] == \ + DEFAULT_UNIT_OF_MEASUREMENT + # Update (replaces 1 device). fire_time_changed(self.hass, utcnow + DEFAULT_UPDATE_INTERVAL) self.hass.block_till_done()