1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Update home zone when core config updated (#24237)

* Update home zone when core config updated

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

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