Просмотр исходного кода

Allow unloading for previously imported config.

Now that config from yaml is ignored, we can unload devices that were imported.
Jason Rumney 4 лет назад
Родитель
Сommit
dc9be50d82
1 измененных файлов с 1 добавлено и 4 удалено
  1. 1 4
      custom_components/tuya_local/__init__.py

+ 1 - 4
custom_components/tuya_local/__init__.py

@@ -8,7 +8,7 @@ https://github.com/codetheweb/tuyapi/issues/31.
 """
 import logging
 
-from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
+from homeassistant.config_entries import ConfigEntry
 from homeassistant.const import CONF_HOST
 from homeassistant.core import HomeAssistant
 
@@ -99,9 +99,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
 
 
 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
-    if entry.data.get(SOURCE_IMPORT):
-        raise ValueError("Devices configured via yaml cannot be deleted from the UI.")
-
     _LOGGER.debug(f"Unloading entry for device: {entry.data[CONF_DEVICE_ID]}")
     config = entry.data
     data = hass.data[DOMAIN][config[CONF_DEVICE_ID]]