Clean up old config entry migration from Tuya (#103026)

This commit is contained in:
Franck Nijhof 2023-10-29 19:18:31 +01:00 committed by GitHub
parent 46ecf0d4bd
commit b323295aa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,6 @@ from .const import (
CONF_COUNTRY_CODE,
CONF_ENDPOINT,
CONF_PASSWORD,
CONF_PROJECT_TYPE,
CONF_USERNAME,
DOMAIN,
LOGGER,
@ -50,13 +49,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Async setup hass config entry."""
hass.data.setdefault(DOMAIN, {})
# Project type has been renamed to auth type in the upstream Tuya IoT SDK.
# This migrates existing config entries to reflect that name change.
if CONF_PROJECT_TYPE in entry.data:
data = {**entry.data, CONF_AUTH_TYPE: entry.data[CONF_PROJECT_TYPE]}
data.pop(CONF_PROJECT_TYPE)
hass.config_entries.async_update_entry(entry, data=data)
auth_type = AuthType(entry.data[CONF_AUTH_TYPE])
api = TuyaOpenAPI(
endpoint=entry.data[CONF_ENDPOINT],