Update home zone when core config updated (#24237)

* Update home zone when core config updated

* Lint
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-05-31 23:03:45 -07:00
1 parent b4374c8c4c
commit b90636f640
7 files changed
+57 -31

No files matched your search

+21
View File
@@ -221,3 +221,24 @@ class TestComponentZone(unittest.TestCase):
assert zone.zone.in_zone(self.hass.states.get('zone.passive_zone'),
latitude, longitude)
async def test_core_config_update(hass):
"""Test updating core config will update home zone."""
assert await setup.async_setup_component(hass, 'zone', {})
home = hass.states.get('zone.home')
await hass.config.async_update(
location_name='Updated Name',
latitude=10,
longitude=20,
)
await hass.async_block_till_done()
home_updated = hass.states.get('zone.home')
assert home is not home_updated
assert home_updated.name == 'Updated Name'
assert home_updated.attributes['latitude'] == 10
assert home_updated.attributes['longitude'] == 20