Zone component config entry support (#14059)
* Initial commit * Add error handling to config flow Change unique identifyer to name Clean up hound comments * Ensure hass home zone is created with correct entity id Fix failing tests * Fix rest of tests * Move zone tests to zone folder Create config flow tests * Add possibility to unload entry * Use hass.data instead of globas * Don't calculate configures zones every loop iteration * No need to know about home zone during setup of entry * Only use name as title * Don't cache hass home zone * Add new tests for setup and setup entry * Break out functionality from init to zone.py * Make hass home zone be created directly * Make sure that config flow doesn't override hass home zone * A newline was missing in const * Configured zones shall not be imported Removed config flow import functionality Improved tests
This commit is contained in:
1 parent
f5de2b9e5b
commit
4b06392442
13 files changed
+351
-83
No files matched your search
@@ -15,6 +15,7 @@ from homeassistant.setup import async_prepare_setup_platform
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.loader import bind_hass
|
||||
from homeassistant.components import group, zone
|
||||
from homeassistant.components.zone.zone import async_active_zone
|
||||
from homeassistant.config import load_yaml_config_file, async_log_exception
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import config_per_platform, discovery
|
||||
@@ -541,7 +542,7 @@ class Device(Entity):
|
||||
elif self.location_name:
|
||||
self._state = self.location_name
|
||||
elif self.gps is not None and self.source_type == SOURCE_TYPE_GPS:
|
||||
zone_state = zone.async_active_zone(
|
||||
zone_state = async_active_zone(
|
||||
self.hass, self.gps[0], self.gps[1], self.gps_accuracy)
|
||||
if zone_state is None:
|
||||
self._state = STATE_NOT_HOME
|
||||
|
||||
@@ -13,7 +13,7 @@ import voluptuous as vol
|
||||
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
|
||||
from homeassistant.components.device_tracker import (
|
||||
PLATFORM_SCHEMA, DOMAIN, ATTR_ATTRIBUTES, ENTITY_ID_FORMAT, DeviceScanner)
|
||||
from homeassistant.components.zone import active_zone
|
||||
from homeassistant.components.zone.zone import active_zone
|
||||
from homeassistant.helpers.event import track_utc_time_change
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import slugify
|
||||
|
||||
Reference in new issue
Block a user