Remove Legacy Works With Nest (#96111)

* Remove Legacy Works With Nest

* Simplify nest configuration

* Cleanup legacy nest config entries
This commit is contained in:
Allen Porter 2023-07-09 19:38:05 -07:00 committed by GitHub
parent 1c54b2e025
commit c4a39bbfb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 704 additions and 2701 deletions

View file

@ -46,23 +46,22 @@ from homeassistant.helpers import (
config_validation as cv,
device_registry as dr,
entity_registry as er,
issue_registry as ir,
)
from homeassistant.helpers.entity_registry import async_entries_for_device
from homeassistant.helpers.typing import ConfigType
from . import api, config_flow
from . import api
from .const import (
CONF_PROJECT_ID,
CONF_SUBSCRIBER_ID,
CONF_SUBSCRIBER_ID_IMPORTED,
DATA_DEVICE_MANAGER,
DATA_NEST_CONFIG,
DATA_SDM,
DATA_SUBSCRIBER,
DOMAIN,
)
from .events import EVENT_NAME_MAP, NEST_EVENT
from .legacy import async_setup_legacy, async_setup_legacy_entry
from .media_source import (
async_get_media_event_store,
async_get_media_source_devices,
@ -114,15 +113,20 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
hass.http.register_view(NestEventMediaView(hass))
hass.http.register_view(NestEventMediaThumbnailView(hass))
if DOMAIN not in config:
return True # ConfigMode.SDM_APPLICATION_CREDENTIALS
hass.data[DOMAIN][DATA_NEST_CONFIG] = config[DOMAIN]
config_mode = config_flow.get_config_mode(hass)
if config_mode == config_flow.ConfigMode.LEGACY:
return await async_setup_legacy(hass, config)
if DOMAIN in config and CONF_PROJECT_ID not in config[DOMAIN]:
ir.async_create_issue(
hass,
DOMAIN,
"legacy_nest_deprecated",
breaks_in_ha_version="2023.8.0",
is_fixable=False,
severity=ir.IssueSeverity.WARNING,
translation_key="legacy_nest_deprecated",
translation_placeholders={
"documentation_url": "https://www.home-assistant.io/integrations/nest/",
},
)
return False
return True
@ -167,9 +171,9 @@ class SignalUpdateCallback:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Nest from a config entry with dispatch between old/new flows."""
config_mode = config_flow.get_config_mode(hass)
if DATA_SDM not in entry.data or config_mode == config_flow.ConfigMode.LEGACY:
return await async_setup_legacy_entry(hass, entry)
if DATA_SDM not in entry.data:
hass.async_create_task(hass.config_entries.async_remove(entry.entry_id))
return False
if entry.unique_id != entry.data[CONF_PROJECT_ID]:
hass.config_entries.async_update_entry(