text: """
  Custom integration to integrate TpLink_Cloud with Home Assistant.
  
  For more details about this integration, please refer to
  https://github.com/njobrien1006/tplink_cloud
  """
  import asyncio
  from datetime import timedelta
  import logging
  
  from homeassistant.config_entries import ConfigEntry
  from homeassistant.core import Config, HomeAssistant, Event
  from homeassistant.exceptions import ConfigEntryNotReady
  from homeassistant.helpers.aiohttp_client import async_get_clientsession
  from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
  
  from .tplinkcloud import IntegrationBlueprintApiClient
  
  from .const import (
      CONF_PASSWORD,
      CONF_USERNAME,
      DOMAIN,
      PLATFORMS,
      STARTUP_MESSAGE,
  )
  
  from homeassistant.const import (
      EVENT_HOMEASSISTANT_STOP,
      EVENT_STATE_CHANGED,
      STATE_UNAVAILABLE,
      STATE_UNKNOWN,
  )
  
  _LOGGER: logging.Logger = logging.getLogger(__package__)
  
  
  async def async_setup(hass: HomeAssistant, config: Config):
      """Set up this integration using YAML is not supported."""
      return True
  
  
  async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
      """Set up this integration using UI."""
      if hass.data.get(DOMAIN) is None:
          hass.data.setdefault(DOMAIN, {})
          _LOGGER.info(STARTUP_MESSAGE)
  
      username = entry.data.get(CONF_USERNAME)
      password = entry.data.get(CONF_PASSWORD)
  
      session = async_get_clientsession(hass)
      client = IntegrationBlueprintApiClient(username, password, session, hass)
      Ret = await client.async_get_devices()
  
      hass.data[DOMAIN][entry.entry_id] = client
  
      if Ret != None:
          for platform in PLATFORMS:
              if entry.options.get(platform, True):
                  hass.async_add_job(
                      hass.config_entries.async_forward_entry_setup(entry, platform)
                  )
  
          await client.start()
  
      async def async_shutdown(event: Event):
          """Shut down the client."""
          await client.kill()
          
      hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_shutdown)
      entry.add_update_listener(async_reload_entry)
      return True
  
  async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
      """Handle removal of an entry."""
      coordinator = hass.data[DOMAIN][entry.entry_id]
      unloaded = all(
          await asyncio.gather(
              *[
                  hass.config_entries.async_forward_entry_unload(entry, platform)
                  for platform in PLATFORMS
                  if platform in coordinator.platforms
              ]
          )
      )
      if unloaded:
          hass.data[DOMAIN].pop(entry.entry_id)
  
      return unloaded
  
  
  async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
      """Reload config entry."""
      await async_unload_entry(hass, entry)
      await async_setup_entry(hass, entry)
  
  