mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Do not configure Shelly config entry created by custom component (#51616)
This commit is contained in:
parent
4007430d72
commit
502939c430
@ -68,6 +68,18 @@ async def async_setup(hass: HomeAssistant, config: dict):
|
|||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Shelly from a config entry."""
|
"""Set up Shelly from a config entry."""
|
||||||
|
# The custom component for Shelly devices uses shelly domain as well as core
|
||||||
|
# integration. If the user removes the custom component but doesn't remove the
|
||||||
|
# config entry, core integration will try to configure that config entry with an
|
||||||
|
# error. The config entry data for this custom component doesn't contain host
|
||||||
|
# value, so if host isn't present, config entry will not be configured.
|
||||||
|
if not entry.data.get(CONF_HOST):
|
||||||
|
_LOGGER.warning(
|
||||||
|
"The config entry %s probably comes from a custom integration, please remove it if you want to use core Shelly integration",
|
||||||
|
entry.title,
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
hass.data[DOMAIN][DATA_CONFIG_ENTRY][entry.entry_id] = {}
|
hass.data[DOMAIN][DATA_CONFIG_ENTRY][entry.entry_id] = {}
|
||||||
hass.data[DOMAIN][DATA_CONFIG_ENTRY][entry.entry_id][DEVICE] = None
|
hass.data[DOMAIN][DATA_CONFIG_ENTRY][entry.entry_id][DEVICE] = None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user