Simplify UniFi entry configuration data (#45759)

* Simplify configuration structure by removing the controller key

* Fix flake8

* Fix review comments

* Don't use migrate_entry mechanism to flatten configuration
Keep legacy configuration when creating new entries as well
This commit is contained in:
Robert Svensson 2021-02-06 21:32:18 +01:00 committed by GitHub
parent cefde8721d
commit 618fcda821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 46 deletions

View file

@ -66,7 +66,7 @@ CONTROLLER_DATA = {
CONF_VERIFY_SSL: False,
}
ENTRY_CONFIG = {CONF_CONTROLLER: CONTROLLER_DATA}
ENTRY_CONFIG = {**CONTROLLER_DATA, CONF_CONTROLLER: CONTROLLER_DATA}
ENTRY_OPTIONS = {}
CONFIGURATION = []
@ -167,6 +167,7 @@ async def setup_unifi_integration(
options=deepcopy(options),
entry_id=1,
unique_id="1",
version=1,
)
config_entry.add_to_hass(hass)
@ -178,8 +179,8 @@ async def setup_unifi_integration(
if aioclient_mock:
mock_default_unifi_requests(
aioclient_mock,
host=config_entry.data[CONF_CONTROLLER][CONF_HOST],
site_id=config_entry.data[CONF_CONTROLLER][CONF_SITE_ID],
host=config_entry.data[CONF_HOST],
site_id=config_entry.data[CONF_SITE_ID],
sites=sites,
description=site_description,
clients_response=clients_response,